From ed9f67c711a17ca3ad2ecd12cc2bd2d049cb6b35 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Thu, 17 Dec 2015 16:18:29 -0800 Subject: [PATCH] Backed out changeset 82cd6a486698 (bug 1233245) for fetch-request-redirect.https.html failures CLOSED TREE --- netwerk/protocol/http/nsHttpChannel.cpp | 36 +++++++++---------- .../navigation-redirect.https.html | 4 +-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index f398ae2075e..c7b3f619495 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -2012,6 +2012,24 @@ nsHttpChannel::StartRedirectChannelToURI(nsIURI *upgradedURI, uint32_t flags) // 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 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); @@ -4587,24 +4605,6 @@ nsHttpChannel::SetupReplacementChannel(nsIURI *newURI, 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 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; } diff --git 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 index 2e842add240..7b606cf0c3c 100644 --- 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 @@ -150,7 +150,7 @@ promise_test(function(t) { return test_redirect( OUT_SCOPE + 'url=' + encodeURIComponent(SCOPE1), SCOPE1, - [[], [], []]); + [[SCOPE1], [], []]); }); }, 'Normal redirect to same-origin scope.'); promise_test(function(t) { @@ -158,7 +158,7 @@ promise_test(function(t) { return test_redirect( OUT_SCOPE + 'url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE), OTHER_ORIGIN_SCOPE, - [[], [], []]); + [[], [], [OTHER_ORIGIN_SCOPE]]); }); }, 'Normal redirect to other-origin scope.');