Index: Source/core/loader/DocumentThreadableLoader.cpp |
diff --git a/Source/core/loader/DocumentThreadableLoader.cpp b/Source/core/loader/DocumentThreadableLoader.cpp |
index bcb00b9b67766a00380e91cad3274af94fc719e0..0c0bfd2394527394800d49b4b2b7b69d797ae11a 100644 |
--- a/Source/core/loader/DocumentThreadableLoader.cpp |
+++ b/Source/core/loader/DocumentThreadableLoader.cpp |
@@ -111,13 +111,16 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequest(const ResourceReques |
{ |
ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl); |
- if ((m_options.preflightPolicy == ConsiderPreflight && isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields())) || m_options.preflightPolicy == PreventPreflight) { |
- // Cross-origin requests are only allowed for HTTP and registered schemes. We would catch this when checking response headers later, but there is no reason to send a request 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 HTTP.")); |
- return; |
- } |
+ // Cross-origin requests are only allowed certain registered schemes. |
+ // We would catch this when checking response headers later, but there |
+ // 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() + ".")); |
+ return; |
+ } |
+ if ((m_options.preflightPolicy == ConsiderPreflight && isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields())) || m_options.preflightPolicy == PreventPreflight) { |
ResourceRequest crossOriginRequest(request); |
ResourceLoaderOptions crossOriginOptions(m_resourceLoaderOptions); |
updateRequestForAccessControl(crossOriginRequest, securityOrigin(), effectiveAllowCredentials()); |