Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2323623002: Do not sniff mime type for fetch() requests (Closed)
Patch Set: fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/fetch/chromium/mime-sniffing.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 1708
1709 // Add the post mime sniffing throttles. 1709 // Add the post mime sniffing throttles.
1710 handler.reset(new ThrottlingResourceHandler( 1710 handler.reset(new ThrottlingResourceHandler(
1711 std::move(handler), request, std::move(post_mime_sniffing_throttles))); 1711 std::move(handler), request, std::move(post_mime_sniffing_throttles)));
1712 1712
1713 PluginService* plugin_service = nullptr; 1713 PluginService* plugin_service = nullptr;
1714 #if defined(ENABLE_PLUGINS) 1714 #if defined(ENABLE_PLUGINS)
1715 plugin_service = PluginService::GetInstance(); 1715 plugin_service = PluginService::GetInstance();
1716 #endif 1716 #endif
1717 1717
1718 // Insert a buffered event handler to sniff the mime type. 1718 // fetch() ignores mime sniffing.
1719 // Note: all ResourceHandler following the MimeSniffingResourceHandler should 1719 if (fetch_request_context_type != REQUEST_CONTEXT_TYPE_FETCH) {
mmenke 2016/09/08 14:19:18 Can we put this logic in MimeTypeHandler? It alre
yhirano 2016/09/14 13:22:18 Done. RESOURCE_TYPE_XHR contains REQUEST_CONTENT_
mmenke 2016/09/15 15:08:39 Can we disable it for XHRs, too? (There's actuall
yhirano 2016/09/20 12:12:31 I hope we can, but I expect that disabling the fea
1720 // expect OnWillRead to be called *before* OnResponseStarted as part of the 1720 // Insert a buffered event handler to sniff the mime type.
1721 // mime sniffing process. 1721 // Note: all ResourceHandler following the MimeSniffingResourceHandler
1722 handler.reset(new MimeSniffingResourceHandler( 1722 // should expect OnWillRead to be called *before* OnResponseStarted as
1723 std::move(handler), this, plugin_service, intercepting_handler, request)); 1723 // part of the mime sniffing process.
1724 handler.reset(new MimeSniffingResourceHandler(
1725 std::move(handler), this, plugin_service, intercepting_handler,
1726 request));
1727 }
1724 1728
1725 // Add the pre mime sniffing throttles. 1729 // Add the pre mime sniffing throttles.
1726 handler.reset(new ThrottlingResourceHandler( 1730 handler.reset(new ThrottlingResourceHandler(
1727 std::move(handler), request, std::move(pre_mime_sniffing_throttles))); 1731 std::move(handler), request, std::move(pre_mime_sniffing_throttles)));
1728 1732
1729 return handler; 1733 return handler;
1730 } 1734 }
1731 1735
1732 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) { 1736 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) {
1733 UnregisterDownloadedTempFile(filter_->child_id(), request_id); 1737 UnregisterDownloadedTempFile(filter_->child_id(), request_id);
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 request_info->GetRouteID(), is_content_initiated, true, &throttles); 2734 request_info->GetRouteID(), is_content_initiated, true, &throttles);
2731 if (!throttles.empty()) { 2735 if (!throttles.empty()) {
2732 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, 2736 handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
2733 std::move(throttles))); 2737 std::move(throttles)));
2734 } 2738 }
2735 } 2739 }
2736 return handler; 2740 return handler;
2737 } 2741 }
2738 2742
2739 } // namespace content 2743 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/fetch/chromium/mime-sniffing.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698