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

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

Issue 333423004: moved to https://codereview.chromium.org/399543002/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cleanup test Created 6 years, 5 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 | « Source/core/fetch/ResourceFetcher.cpp ('k') | Source/core/timing/Performance.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 a7c82ef910716aed701c02dd3f609ad45492ca9c..22c9b09b28f7916866ff372897f9e4445131d64e 100644
--- a/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/Source/core/loader/DocumentThreadableLoader.cpp
@@ -183,6 +183,15 @@ void DocumentThreadableLoader::redirectReceived(Resource* resource, ResourceRequ
ASSERT_UNUSED(resource, resource == this->resource());
RefPtr<DocumentThreadableLoader> protect(this);
+
+ // We don't support redirect in Fech API yet.
+ // FIXME: Support redirect in Fech API.
+ if (resource->resourceRequest().requestContext() == blink::WebURLRequest::RequestContextFetch) {
+ m_client->didFailRedirectCheck();
+ request = ResourceRequest();
+ return;
+ }
+
if (!isAllowedByPolicy(request.url())) {
m_client->didFailRedirectCheck();
request = ResourceRequest();
@@ -319,7 +328,26 @@ void DocumentThreadableLoader::handleResponse(unsigned long identifier, const Re
return;
}
- // FIXME: When response.wasFetchedViaServiceWorker() is true, we need to check the URL of the response for CSP and CORS.
+ // If the response is fetched via ServiceWorker, the original URL of the response could be different from the URL of the request.
+ if (response.wasFetchedViaServiceWorker()) {
+ if (!isAllowedByPolicy(response.url())) {
+ m_client->didFailRedirectCheck();
+ return;
+ }
+ if (!isAllowedRedirect(response.url())) {
+ if (m_options.crossOriginRequestPolicy == DenyCrossOriginRequests) {
+ m_client->didFail(ResourceError(errorDomainBlinkInternal, 0, response.url().string(), "Cross origin requests are not supported."));
+ return;
+ }
+ if (m_options.crossOriginRequestPolicy == UseAccessControl) {
+ String accessControlErrorDescription;
+ if (!passesAccessControlCheck(response, effectiveAllowCredentials(), securityOrigin(), accessControlErrorDescription)) {
+ m_client->didFailAccessControlCheck(ResourceError(errorDomainBlinkInternal, 0, response.url().string(), accessControlErrorDescription));
+ return;
+ }
+ }
+ }
+ }
if (!m_sameOriginRequest && m_options.crossOriginRequestPolicy == UseAccessControl) {
String accessControlErrorDescription;
« no previous file with comments | « Source/core/fetch/ResourceFetcher.cpp ('k') | Source/core/timing/Performance.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698