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(); |
} |