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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2323623002: Do not sniff mime type for fetch() requests (Closed)
Patch Set: 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
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..602168363cdb5d39846e192ec5958791f4933152 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1715,12 +1715,17 @@ 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));
+ if (fetch_request_context_type != REQUEST_CONTEXT_TYPE_FETCH) {
+ // fetch() ignores mime sniffing.
tyoshino (SeeGerritForStatus) 2016/09/08 06:04:31 place above the if
yhirano 2016/09/08 06:08:39 Done.
+ //
+ // 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(

Powered by Google App Engine
This is Rietveld 408576698