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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 21183c34ab6026001aeeccdfca30332555a1e1f1..34c2591daad77bd5c7126a9efe54c72981fcaca2 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1715,12 +1715,16 @@ ResourceDispatcherHostImpl::AddStandardHandlers(
plugin_service = PluginService::GetInstance();
#endif
- // Insert a buffered event handler to sniff the mime type.
- // Note: all ResourceHandler following the MimeSniffingResourceHandler should
- // expect OnWillRead to be called *before* OnResponseStarted as part of the
- // mime sniffing process.
- handler.reset(new MimeSniffingResourceHandler(
- std::move(handler), this, plugin_service, intercepting_handler, request));
+ // fetch() ignores mime sniffing.
+ 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
+ // Insert a buffered event handler to sniff the mime type.
+ // Note: all ResourceHandler following the MimeSniffingResourceHandler
+ // should expect OnWillRead to be called *before* OnResponseStarted as
+ // part of the mime sniffing process.
+ handler.reset(new MimeSniffingResourceHandler(
+ std::move(handler), this, plugin_service, intercepting_handler,
+ request));
+ }
// Add the pre mime sniffing throttles.
handler.reset(new ThrottlingResourceHandler(
« 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