Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(892)

Unified Diff: Source/core/loader/DocumentThreadableLoader.cpp

Issue 892073002: [deprecated][Restart] clearResource Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/web/tests/AssociatedURLLoaderTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/Source/core/loader/DocumentThreadableLoader.cpp b/Source/core/loader/DocumentThreadableLoader.cpp
index 2f1314a8201119b4384ecdaee6c54e3af5e1113c..d548a758486423223ef23a082d3abad5f422e3ec 100644
--- a/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/Source/core/loader/DocumentThreadableLoader.cpp
@@ -162,7 +162,7 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequest(const ResourceReques
// is no reason to send a request, preflighted or not, that's guaranteed
// to be denied.
if (!SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) {
- m_client->didFailAccessControlCheck(ResourceError(errorDomainBlinkInternal, 0, request.url().string(), "Cross origin requests are only supported for protocol schemes: " + SchemeRegistry::listOfCORSEnabledURLSchemes() + "."));
+ handlePreflightFailure(request.url().string(), "Cross origin requests are only supported for protocol schemes: " + SchemeRegistry::listOfCORSEnabledURLSchemes() + ".");
return;
}
@@ -335,8 +335,7 @@ void DocumentThreadableLoader::redirectReceived(Resource* resource, ResourceRequ
return;
}
- ResourceError error(errorDomainBlinkInternal, 0, redirectResponse.url().string(), accessControlErrorDescription);
- m_client->didFailAccessControlCheck(error);
+ handlePreflightFailure(redirectResponse.url().string(), accessControlErrorDescription);
} else {
m_client->didFailRedirectCheck();
}
@@ -436,7 +435,7 @@ void DocumentThreadableLoader::handleResponse(unsigned long identifier, const Re
String accessControlErrorDescription;
if (!passesAccessControlCheck(&m_document, response, effectiveAllowCredentials(), securityOrigin(), accessControlErrorDescription)) {
reportResponseReceived(identifier, response);
- m_client->didFailAccessControlCheck(ResourceError(errorDomainBlinkInternal, 0, response.url().string(), accessControlErrorDescription));
+ handlePreflightFailure(response.url().string(), accessControlErrorDescription);
return;
}
}
@@ -534,9 +533,17 @@ void DocumentThreadableLoader::handlePreflightFailure(const String& url, const S
// Prevent handleSuccessfulFinish() from bypassing access check.
m_actualRequest = nullptr;
+ // Do not call didFailAccessControlCheck() directly from other places in
+ // DocumentThreadableLoader.
+ // Call handlePreflightFailure() to prevent m_client's handlers from
+ // being called after didFailAccessControlCheck().
+
// FIXME: Should prevent timeout from being overridden after preflight failure, without
// resetting m_requestStartedSeconds to 0.0
m_client->didFailAccessControlCheck(error);
+
+ // Prevent m_client's handlers from being called later.
+ clearResource();
}
void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, ResourceLoaderOptions resourceLoaderOptions)
« no previous file with comments | « no previous file | Source/web/tests/AssociatedURLLoaderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698