Chromium Code Reviews| Index: Source/core/fetch/ResourceFetcher.cpp |
| diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp |
| index 6b2bfe97fc9e3b61441668040af29eb7048911f6..7bffc2eec7b0c451888741edc3e6fca478f178e5 100644 |
| --- a/Source/core/fetch/ResourceFetcher.cpp |
| +++ b/Source/core/fetch/ResourceFetcher.cpp |
| @@ -1299,7 +1299,14 @@ void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& |
| void ResourceFetcher::didReceiveResponse(const Resource* resource, const ResourceResponse& response) |
| { |
| - // FIXME: When response.wasFetchedViaServiceWorker() is true, we need to check the URL of the responce 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 (!canRequest(resource->type(), resource->lastResourceRequest().requestContext(), response.url(), resource->options(), false, FetchRequest::UseDefaultOriginRestrictionForType)) { |
| + resource->loader()->cancel(); |
| + context().dispatchDidFail(m_documentLoader, resource->identifier(), ResourceError(errorDomainBlinkInternal, 0, response.url().string(), "Original url check of ServiceWorker fetched resource failed.")); |
|
jochen (gone - plz use gerrit)
2014/07/24 14:37:26
the error message would leave me a bit confused ab
horo
2014/07/24 15:50:22
Done.
|
| + return; |
| + } |
| + } |
| context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier(), response, resource->loader()); |
| } |