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

Unified Diff: content/child/web_url_loader_impl.cc

Issue 375513002: [ServiceWorker] Propagates ServiceWorker fetched response's URL and wasFetchedViaServiceWorker flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: *original_url_via_service_worker = GURL(); 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 | « content/child/resource_dispatcher.cc ('k') | content/common/resource_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/web_url_loader_impl.cc
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index 5fe04707bed2d64298d13c550dd4029bed75870e..de4cfb0f1634b07def61137e6ba4ff0eae1ebc37 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -530,6 +530,12 @@ 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");
@@ -752,6 +758,7 @@ void WebURLLoaderImpl::PopulateURLResponse(const GURL& url,
response->setConnectionID(info.load_timing.socket_log_id);
response->setConnectionReused(info.load_timing.socket_reused);
response->setDownloadFilePath(info.download_file_path.AsUTF16Unsafe());
+ response->setWasFetchedViaServiceWorker(info.was_fetched_via_service_worker);
WebURLResponseExtraDataImpl* extra_data =
new WebURLResponseExtraDataImpl(info.npn_negotiated_protocol);
response->setExtraData(extra_data);
« no previous file with comments | « content/child/resource_dispatcher.cc ('k') | content/common/resource_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698