Commit bc363cfb authored by Ting Shao's avatar Ting Shao Committed by Commit Bot

ServiceWorker: Set network isolation key for update check

This fixes a failing browser test:
WorkerNetworkIsolationKeyBrowserTest.ServiceWorkerMainScriptRequest when
ServiceWorkerImportedScriptUpdateCheck is enabled. It's caused by missing
the network isolation key for requests generated during update check.

Network isolation key is used to separate requests from different
contexts when accessing shared network resources like http cache.
It's necessary for service worker update check.

Bug: 648295
Change-Id: Id97e1e60ea2ceb7f59211dfcb6b2e32776455487
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1716391Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Ting Shao <ting.shao@intel.com>
Cr-Commit-Position: refs/heads/master@{#682178}
parent a42f4daf
......@@ -119,7 +119,13 @@ ServiceWorkerSingleScriptUpdateChecker::ServiceWorkerSingleScriptUpdateChecker(
// https://fetch.spec.whatwg.org/#concept-request-origin
// It's needed to be set to the origin of the main script url.
// https://github.com/w3c/ServiceWorker/issues/1447
resource_request.request_initiator = url::Origin::Create(main_script_url);
const url::Origin origin = url::Origin::Create(main_script_url);
resource_request.request_initiator = origin;
// This key is used to isolate requests from different contexts in accessing
// shared network resources like the http cache.
resource_request.trusted_network_isolation_key =
net::NetworkIsolationKey(origin, origin);
if (is_main_script_) {
// Set the "Service-Worker" header for the main script request:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment