Index: Source/core/loader/DocumentThreadableLoader.cpp |
diff --git a/Source/core/loader/DocumentThreadableLoader.cpp b/Source/core/loader/DocumentThreadableLoader.cpp |
index 4271425ee490fdfc47dc872b02301b4205f0fd7f..087548814abd6d2e48572dd7ec60031d84237296 100644 |
--- a/Source/core/loader/DocumentThreadableLoader.cpp |
+++ b/Source/core/loader/DocumentThreadableLoader.cpp |
@@ -187,7 +187,8 @@ void DocumentThreadableLoader::redirectReceived(CachedResource* resource, Resour |
} |
// When using access control, only simple cross origin requests are allowed to redirect. The new request URL must have a supported |
- // scheme and not contain the userinfo production. In addition, the redirect response must pass the access control check. |
+ // 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) { |
bool allowRedirect = false; |
if (m_simpleRequest) { |
@@ -195,7 +196,7 @@ void DocumentThreadableLoader::redirectReceived(CachedResource* resource, Resour |
allowRedirect = SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol()) |
&& request.url().user().isEmpty() |
&& request.url().pass().isEmpty() |
- && passesAccessControlCheck(redirectResponse, m_options.allowCredentials, securityOrigin(), accessControlErrorDescription); |
+ && (m_sameOriginRequest || passesAccessControlCheck(redirectResponse, m_options.allowCredentials, securityOrigin(), accessControlErrorDescription)); |
abarth-chromium
2013/05/09 04:22:06
Ah, I see. I was mis-reading the implementation o
|
} |
if (allowRedirect) { |
@@ -210,6 +211,11 @@ void DocumentThreadableLoader::redirectReceived(CachedResource* resource, Resour |
// Force any subsequent requests to use these checks. |
m_sameOriginRequest = false; |
+ // Since the request is no longer same-origin, if the user didn't request credentials in |
+ // the first place, update our state so we neither request them nor expect they must be allowed. |
+ if (m_options.credentialsRequested == ClientDidNotRequestCredentials) |
+ m_options.allowCredentials = DoNotAllowStoredCredentials; |
+ |
// Remove any headers that may have been added by the network layer that cause access control to fail. |
request.clearHTTPContentType(); |
request.clearHTTPReferrer(); |