| Index: Source/core/fetch/ResourceFetcher.cpp
|
| diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp
|
| index 0003e2ae1f4ae9a6a3422eba1717fe9f4d863bc6..aea5e534efdcfb36760fb285b3ee034456285f9a 100644
|
| --- a/Source/core/fetch/ResourceFetcher.cpp
|
| +++ b/Source/core/fetch/ResourceFetcher.cpp
|
| @@ -1336,7 +1336,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(), 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."));
|
| + return;
|
| + }
|
| + }
|
| context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier(), response, resource->loader());
|
| }
|
|
|
|
|