Bug 1195167 part 2: Remove redundant aCORSFlag argument and instead use mCORSFlagEverSet. r=bkelly

This commit is contained in:
Jonas Sicking 2015-10-19 18:24:36 -07:00
parent be2deca017
commit 531997fc91
2 changed files with 11 additions and 11 deletions

View File

@ -72,11 +72,11 @@ FetchDriver::Fetch(FetchDriverObserver* aObserver)
Telemetry::Accumulate(Telemetry::SERVICE_WORKER_REQUEST_PASSTHROUGH,
mRequest->WasCreatedByFetchEvent());
return Fetch(false /* CORS flag */);
return Fetch();
}
nsresult
FetchDriver::Fetch(bool aCORSFlag)
FetchDriver::Fetch()
{
// We do not currently implement parts of the spec that lead to recursion.
MOZ_ASSERT(mFetchRecursionCount == 0);
@ -86,7 +86,7 @@ FetchDriver::Fetch(bool aCORSFlag)
if (!mRequest->IsSynchronous() && mFetchRecursionCount <= 1) {
nsCOMPtr<nsIRunnable> r =
NS_NewRunnableMethodWithArg<bool>(this, &FetchDriver::ContinueFetch, aCORSFlag);
NS_NewRunnableMethod(this, &FetchDriver::ContinueFetch);
nsresult rv = NS_DispatchToCurrentThread(r);
if (NS_WARN_IF(NS_FAILED(rv))) {
FailWithNetworkError();
@ -98,7 +98,7 @@ FetchDriver::Fetch(bool aCORSFlag)
}
FetchDriver::MainFetchOp
FetchDriver::SetTaintingAndGetNextOp(bool aCORSFlag)
FetchDriver::SetTaintingAndGetNextOp()
{
workers::AssertIsOnMainThread();
@ -143,7 +143,7 @@ FetchDriver::SetTaintingAndGetNextOp(bool aCORSFlag)
// request's current url's scheme is "about"
rv = mPrincipal->CheckMayLoad(requestURI, false /* report */,
false /* allowIfInheritsPrincipal */);
if ((!aCORSFlag && NS_SUCCEEDED(rv)) ||
if ((!mCORSFlagEverSet && NS_SUCCEEDED(rv)) ||
(scheme.EqualsLiteral("data") && mRequest->SameOriginDataURL()) ||
scheme.EqualsLiteral("about")) {
return MainFetchOp(BASIC_FETCH);
@ -185,11 +185,11 @@ FetchDriver::SetTaintingAndGetNextOp(bool aCORSFlag)
}
nsresult
FetchDriver::ContinueFetch(bool aCORSFlag)
FetchDriver::ContinueFetch()
{
workers::AssertIsOnMainThread();
MainFetchOp nextOp = SetTaintingAndGetNextOp(aCORSFlag);
MainFetchOp nextOp = SetTaintingAndGetNextOp();
if (nextOp.mType == NETWORK_ERROR) {
return FailWithNetworkError();
@ -882,7 +882,7 @@ FetchDriver::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
mRequest->SetURL(newUrl);
// Implement Main Fetch step 8 again on redirect.
MainFetchOp nextOp = SetTaintingAndGetNextOp(mCORSFlagEverSet);
MainFetchOp nextOp = SetTaintingAndGetNextOp();
if (nextOp.mType == NETWORK_ERROR) {
// Cancel the channel if Main Fetch blocks the redirect from continuing.

View File

@ -113,9 +113,9 @@ private:
bool mCORSPreflightFlag;
};
nsresult Fetch(bool aCORSFlag);
MainFetchOp SetTaintingAndGetNextOp(bool aCORSFlag);
nsresult ContinueFetch(bool aCORSFlag);
nsresult Fetch();
MainFetchOp SetTaintingAndGetNextOp();
nsresult ContinueFetch();
nsresult BasicFetch();
nsresult HttpFetch(bool aCORSFlag = false, bool aCORSPreflightFlag = false, bool aAuthenticationFlag = false);
nsresult ContinueHttpFetchAfterNetworkFetch();