Backed out changeset 82cd6a486698 (bug 1233245) for fetch-request-redirect.https.html failures CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Thu, 17 Dec 2015 16:18:29 -0800
changeset 316209 1c8ba5322a17dc0aff2c1c90a9b8d18ed7867ad2
parent 316208 601650ded452dd1705eb30a8abe28cc1cd886876
child 316210 3dc64c1fffbe84b19e486e6818b2f200d5335450
child 316328 6dfa4c059395231c2a740c03bed29b8964b123d1
push id8516
push userjlund@mozilla.com
push dateFri, 18 Dec 2015 00:52:34 +0000
bugs1233245
milestone46.0a1
backs out82cd6a486698b4191411ba5de448c1bca518a699
Backed out changeset 82cd6a486698 (bug 1233245) for fetch-request-redirect.https.html failures CLOSED TREE
netwerk/protocol/http/nsHttpChannel.cpp
testing/web-platform/mozilla/tests/service-workers/service-worker/navigation-redirect.https.html
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -2007,16 +2007,34 @@ nsHttpChannel::StartRedirectChannelToURI
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = SetupReplacementChannel(upgradedURI, newChannel, true, flags);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Inform consumers about this fake redirect
     mRedirectChannel = newChannel;
 
+    if (!(flags & nsIChannelEventSink::REDIRECT_STS_UPGRADE)) {
+        // Ensure that internally-redirected channels cannot be intercepted, which would look
+        // like two separate requests to the nsINetworkInterceptController.
+        if (mInterceptCache == INTERCEPTED) {
+            nsCOMPtr<nsIHttpChannelInternal> httpRedirect = do_QueryInterface(mRedirectChannel);
+            if (httpRedirect) {
+                httpRedirect->ForceIntercepted(mInterceptionID);
+            }
+        } else {
+            nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL;
+            rv = mRedirectChannel->GetLoadFlags(&loadFlags);
+            NS_ENSURE_SUCCESS(rv, rv);
+            loadFlags |= nsIChannel::LOAD_BYPASS_SERVICE_WORKER;
+            rv = mRedirectChannel->SetLoadFlags(loadFlags);
+            NS_ENSURE_SUCCESS(rv, rv);
+        }
+    }
+
     PushRedirectAsyncFunc(
         &nsHttpChannel::ContinueAsyncRedirectChannelToURI);
     rv = gHttpHandler->AsyncOnChannelRedirect(this, newChannel, flags);
 
     if (NS_SUCCEEDED(rv))
         rv = WaitForRedirectCallback();
 
     if (NS_FAILED(rv)) {
@@ -4582,34 +4600,16 @@ nsHttpChannel::SetupReplacementChannel(n
         nsCOMPtr<nsIResumableChannel> resumableChannel(do_QueryInterface(newChannel));
         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)) {
-        // Ensure that internally-redirected channels cannot be intercepted, which would look
-        // like two separate requests to the nsINetworkInterceptController.
-        if (mInterceptCache == INTERCEPTED) {
-            nsCOMPtr<nsIHttpChannelInternal> httpRedirect = do_QueryInterface(newChannel);
-            if (httpRedirect) {
-                httpRedirect->ForceIntercepted(mInterceptionID);
-            }
-        } else {
-            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);
-        }
-    }
-
     return NS_OK;
 }
 
 nsresult
 nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType)
 {
     LOG(("nsHttpChannel::AsyncProcessRedirection [this=%p type=%u]\n",
         this, redirectType));
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/navigation-redirect.https.html
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/navigation-redirect.https.html
@@ -145,25 +145,25 @@ function get_intercepted_urls(worker) {
 }
 
 // Normal redirect.
 promise_test(function(t) {
     return setup_environment(t).then(function() {
         return test_redirect(
             OUT_SCOPE + 'url=' + encodeURIComponent(SCOPE1),
             SCOPE1,
-            [[], [], []]);
+            [[SCOPE1], [], []]);
       });
   }, 'Normal redirect to same-origin scope.');
 promise_test(function(t) {
     return setup_environment(t).then(function() {
         return test_redirect(
             OUT_SCOPE + 'url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE),
             OTHER_ORIGIN_SCOPE,
-            [[], [], []]);
+            [[], [], [OTHER_ORIGIN_SCOPE]]);
       });
   }, 'Normal redirect to other-origin scope.');
 
 // SW fallbacked redirect. SW doesn't handle the fetch request.
 promise_test(function(t) {
     return setup_environment(t).then(function() {
         return test_redirect(
             SCOPE1 + 'url=' + encodeURIComponent(OUT_SCOPE),