Bug 1210941 P6 Use LOAD_BYPASS_SERVICE_WORKER instead of ForceNoIntercept in FetchDriver. r=ehsan

This commit is contained in:
Ben Kelly 2015-10-06 06:37:07 -07:00
parent 86810e04e9
commit a6f4c63338

View File

@ -428,6 +428,12 @@ FetchDriver::HttpFetch(bool aCORSFlag, bool aCORSPreflightFlag, bool aAuthentica
// new cookies sent by the server from being stored.
const nsLoadFlags credentialsFlag = useCredentials ? 0 : nsIRequest::LOAD_ANONYMOUS;
// Set skip serviceworker flag.
// While the spec also gates on the client being a ServiceWorker, we can't
// infer that here. Instead we rely on callers to set the flag correctly.
const nsLoadFlags bypassFlag = mRequest->SkipServiceWorker() ?
nsIChannel::LOAD_BYPASS_SERVICE_WORKER : 0;
// From here on we create a channel and set its properties with the
// information from the InternalRequest. This is an implementation detail.
MOZ_ASSERT(mLoadGroup);
@ -439,7 +445,7 @@ FetchDriver::HttpFetch(bool aCORSFlag, bool aCORSPreflightFlag, bool aAuthentica
mRequest->ContentPolicyType(),
mLoadGroup,
nullptr, /* aCallbacks */
nsIRequest::LOAD_NORMAL | credentialsFlag,
nsIRequest::LOAD_NORMAL | credentialsFlag | bypassFlag,
ios);
mLoadGroup = nullptr;
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -575,21 +581,6 @@ FetchDriver::HttpFetch(bool aCORSFlag, bool aCORSPreflightFlag, bool aAuthentica
}
}
// Set skip serviceworker flag.
// While the spec also gates on the client being a ServiceWorker, we can't
// infer that here. Instead we rely on callers to set the flag correctly.
if (mRequest->SkipServiceWorker()) {
if (httpChan) {
nsCOMPtr<nsIHttpChannelInternal> internalChan = do_QueryInterface(httpChan);
internalChan->ForceNoIntercept();
} else {
nsCOMPtr<nsIJARChannel> jarChannel = do_QueryInterface(chan);
// If it is not an http channel, it has to be a jar one.
MOZ_ASSERT(jarChannel);
jarChannel->ForceNoIntercept();
}
}
nsCOMPtr<nsIStreamListener> listener = this;
// Only use nsCORSListenerProxy if we are in CORS mode. Otherwise it