Index: Source/core/fetch/ResourceFetcher.cpp |
diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp |
index 69fa5bb29ba1be880310e32aefe94d85927510e9..67b9d6f6f1a797358ab34b1838a63d92386056da 100644 |
--- a/Source/core/fetch/ResourceFetcher.cpp |
+++ b/Source/core/fetch/ResourceFetcher.cpp |
@@ -1349,10 +1349,14 @@ void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc |
// 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->resourceRequest(), response.url(), resource->options(), false, FetchRequest::UseDefaultOriginRestrictionForType)) { |
+ KURL originalURL = response.url(); |
+ // FIXME: Use response.originalURLViaServiceWorker() after the chromium side patch will land. |
+ if (!response.originalURLViaServiceWorker().isEmpty()) |
+ originalURL = response.originalURLViaServiceWorker(); |
+ if (!canRequest(resource->type(), resource->resourceRequest(), originalURL, resource->options(), false, FetchRequest::UseDefaultOriginRestrictionForType)) { |
resource->loader()->cancel(); |
bool isInternalRequest = resource->options().initiatorInfo.name == FetchInitiatorTypeNames::internal; |
- context().dispatchDidFail(m_documentLoader, resource->identifier(), ResourceError(errorDomainBlinkInternal, 0, response.url().string(), "Unsafe attempt to load URL " + response.url().elidedString() + " fetched by a ServiceWorker."), isInternalRequest); |
+ context().dispatchDidFail(m_documentLoader, resource->identifier(), ResourceError(errorDomainBlinkInternal, 0, originalURL.string(), "Unsafe attempt to load URL " + originalURL.elidedString() + " fetched by a ServiceWorker."), isInternalRequest); |
return; |
} |
} |