Commit b6099f6e authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Fix SharedWorker URLLoaderFactory NetworkIsolationKey.

SharedWorkerServiceImpl was using a SiteForCookies based on the URL of
the worker being loaded, but a NetworkIsolationKey based on the URL of
the RenderFrameHost. In practice, these are always the same...except for
the case of extensions loading a SharedWorker of some site. This CL
fixes the issue.

Bug: 1052148
Change-Id: I53d37354defdcca5fe0ea3f1412ee7a638016a5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2057525
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743140}
parent 5853fbdc
......@@ -314,8 +314,7 @@ SharedWorkerHost* SharedWorkerServiceImpl::CreateWorker(
RenderFrameHostImpl* creator_render_frame_host =
RenderFrameHostImpl::FromID(creator_render_frame_host_id);
url::Origin origin(
creator_render_frame_host->frame_tree_node()->current_origin());
url::Origin worker_origin = url::Origin::Create(host->instance().url());
base::WeakPtr<SharedWorkerHost> weak_host = host->AsWeakPtr();
// Cloning before std::move() so that the object can be used in two functions.
......@@ -326,10 +325,9 @@ SharedWorkerHost* SharedWorkerServiceImpl::CreateWorker(
// cross-site contexts. Fix this.
WorkerScriptFetchInitiator::Start(
worker_process_host->GetID(), host->instance().url(),
creator_render_frame_host,
net::SiteForCookies::FromUrl(host->instance().url()),
creator_render_frame_host, net::SiteForCookies::FromOrigin(worker_origin),
host->instance().constructor_origin(),
net::NetworkIsolationKey(origin, origin), credentials_mode,
net::NetworkIsolationKey(worker_origin, worker_origin), credentials_mode,
std::move(outside_fetch_client_settings_object),
blink::mojom::ResourceType::kSharedWorker, service_worker_context_,
service_worker_handle_raw, std::move(appcache_host),
......
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