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

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

Issue 23582002: CORS: Update the redirection status in Inspector Network tab for CORS requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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
Index: Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/Source/core/loader/DocumentThreadableLoader.cpp b/Source/core/loader/DocumentThreadableLoader.cpp
index 247f43c8bb743553d9e07826b945988685f3c213..85220377521c9688890c4756d5620b75426e7e3a 100644
--- a/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/Source/core/loader/DocumentThreadableLoader.cpp
@@ -206,13 +206,20 @@ void DocumentThreadableLoader::redirectReceived(Resource* resource, ResourceRequ
// scheme and not contain the userinfo production. In addition, the redirect response must pass the access control check if the
// original request was not same-origin.
if (m_options.crossOriginRequestPolicy == UseAccessControl) {
+
+ DocumentLoader* loader = m_document->frame()->loader()->documentLoader();
+ InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_document->frame(), resource->identifier(), redirectResponse);
pfeldman 2013/08/27 14:21:33 You should not need 2 instrumenting signals here,
ancilgeorge 2013/08/28 08:14:36 Done.
+ InspectorInstrumentation::didReceiveCORSRedirectResponse(cookie, resource->identifier(), loader, redirectResponse, 0, resource->loadFinishTime());
+
bool allowRedirect = false;
+ String accessControlErrorDescription;
if (m_simpleRequest) {
- String accessControlErrorDescription;
allowRedirect = SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())
&& request.url().user().isEmpty()
&& request.url().pass().isEmpty()
&& (m_sameOriginRequest || passesAccessControlCheck(redirectResponse, m_options.allowCredentials, securityOrigin(), accessControlErrorDescription));
+ } else {
+ accessControlErrorDescription = "Cross Origin Requests with preflight cannot be redirected";
}
if (allowRedirect) {
@@ -243,9 +250,12 @@ void DocumentThreadableLoader::redirectReceived(Resource* resource, ResourceRequ
makeCrossOriginAccessRequest(request);
return;
}
- }
- m_client->didFailRedirectCheck();
+ ResourceError error(errorDomainWebKitInternal, 0, redirectResponse.url().string(), accessControlErrorDescription);
+ m_client->didFailAccessControlCheck(error);
+ } else {
+ m_client->didFailRedirectCheck();
+ }
request = ResourceRequest();
}

Powered by Google App Engine
This is Rietveld 408576698