Bug 1363848 P3 Don't set LOAD_BYPASS_SERVICE_WORKER flag on internal redirects in nsHttpChannel. r=dragana a=lizzard
authorBen Kelly <ben@wanderview.com>
Fri, 16 Jun 2017 11:17:36 -0700
changeset 413997 74875a638dcd11ab0fc2bb329cb72914712a6475
parent 413996 a2ec6f92b8df102c0849762cdc77c406c9e88503
child 413998 574dac67fc5bdd63f96a70e88f5d85ef611e046e
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana, lizzard
bugs1363848
milestone55.0
Bug 1363848 P3 Don't set LOAD_BYPASS_SERVICE_WORKER flag on internal redirects in nsHttpChannel. r=dragana a=lizzard
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -5484,30 +5484,24 @@ nsHttpChannel::SetupReplacementChannel(n
         if (!resumableChannel) {
             NS_WARNING("Got asked to resume, but redirected to non-resumable channel!");
             return NS_ERROR_NOT_RESUMABLE;
         }
         resumableChannel->ResumeAt(mStartPos, mEntityID);
     }
 
     if (!(redirectFlags & nsIChannelEventSink::REDIRECT_STS_UPGRADE) &&
-        mInterceptCache != INTERCEPTED) {
-        // Ensure that internally-redirected channels, or loads with manual
-        // redirect mode cannot be intercepted, which would look like two
-        // separate requests to the nsINetworkInterceptController.
-        if (mRedirectMode != nsIHttpChannelInternal::REDIRECT_MODE_MANUAL ||
-            (redirectFlags & (nsIChannelEventSink::REDIRECT_TEMPORARY |
-                              nsIChannelEventSink::REDIRECT_PERMANENT)) == 0) {
-            nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL;
-            rv = newChannel->GetLoadFlags(&loadFlags);
-            NS_ENSURE_SUCCESS(rv, rv);
-            loadFlags |= nsIChannel::LOAD_BYPASS_SERVICE_WORKER;
-            rv = newChannel->SetLoadFlags(loadFlags);
-            NS_ENSURE_SUCCESS(rv, rv);
-        }
+        mInterceptCache != INTERCEPTED &&
+        mRedirectMode != nsIHttpChannelInternal::REDIRECT_MODE_MANUAL) {
+      nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL;
+      rv = newChannel->GetLoadFlags(&loadFlags);
+      NS_ENSURE_SUCCESS(rv, rv);
+      loadFlags |= nsIChannel::LOAD_BYPASS_SERVICE_WORKER;
+      rv = newChannel->SetLoadFlags(loadFlags);
+      NS_ENSURE_SUCCESS(rv, rv);
     }
 
     if (redirectFlags & nsIChannelEventSink::REDIRECT_INTERNAL) {
       nsCOMPtr<nsITimedChannel> timedChannel = do_QueryInterface(newChannel);
       if (timedChannel) {
         timedChannel->SetLaunchServiceWorkerStart(mLaunchServiceWorkerStart);
         timedChannel->SetLaunchServiceWorkerEnd(mLaunchServiceWorkerEnd);
         timedChannel->SetDispatchFetchEventStart(mDispatchFetchEventStart);