0

Use the request URL as the URL of the resources which are fetched ServiceWorker [2/3 chromium]

1/3 blink: https://codereview.chromium.org/732963003
 - Intorduce originalURLViaServiceWorker in ResourceResponse and WebURLResponse
 - Change CSP check to use originalURLViaServiceWorker if exists in ResourceFetcher::didReceiveResponse().
2/3 chromium: https://codereview.chromium.org/731983003 [THIS PATCH]
 - Stop updating the request's URL in ResourceDispatcher::OnReceivedResponse() and WebURLLoaderImpl::Context::OnReceivedResponse().
 - Set WebURLResponse's originalURLViaServiceWorker in WebURLLoaderImpl::PopulateURLResponse().
3/3 blink: https://codereview.chromium.org/732003002
 - Change CSP check to use originalURLViaServiceWorker.
 - Add LayoutTest for this bug.

BUG=433743

Review URL: https://codereview.chromium.org/731983003

Cr-Commit-Position: refs/heads/master@{#305075}
This commit is contained in:
horo
2014-11-20 12:33:30 -08:00
committed by Commit bot
parent aa5ac2e2e0
commit 20db5d6d85
2 changed files with 3 additions and 13 deletions

@ -377,13 +377,6 @@ void ResourceDispatcher::OnReceivedResponse(
request_info->peer = new_peer;
}
// Updates the response_url if the response was fetched by a ServiceWorker,
// and it was not generated inside the ServiceWorker.
if (response_head.was_fetched_via_service_worker &&
!response_head.original_url_via_service_worker.is_empty()) {
request_info->response_url = response_head.original_url_via_service_worker;
}
ResourceResponseInfo renderer_response_info;
ToResourceResponseInfo(*request_info, response_head, &renderer_response_info);
request_info->site_isolation_metadata =

@ -629,12 +629,6 @@ void WebURLLoaderImpl::Context::OnReceivedResponse(
WebURLResponse response;
response.initialize();
// Updates the request url if the response was fetched by a ServiceWorker,
// and it was not generated inside the ServiceWorker.
if (info.was_fetched_via_service_worker &&
!info.original_url_via_service_worker.is_empty()) {
request_.setURL(info.original_url_via_service_worker);
}
PopulateURLResponse(request_.url(), info, &response);
bool show_raw_listing = (GURL(request_.url()).query() == "raw");
@ -1017,6 +1011,9 @@ void WebURLLoaderImpl::PopulateURLResponse(const GURL& url,
response->setWasFallbackRequiredByServiceWorker(
info.was_fallback_required_by_service_worker);
response->setServiceWorkerResponseType(info.response_type_via_service_worker);
response->setOriginalURLViaServiceWorker(
info.original_url_via_service_worker);
WebURLResponseExtraDataImpl* extra_data =
new WebURLResponseExtraDataImpl(info.npn_negotiated_protocol);
response->setExtraData(extra_data);