New issue
Advanced search Search tips

Issue 923247 link

Starred by 2 users

Issue metadata

Status: Started
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac , Fuchsia
Pri: 1
Type: Bug

Blocking:
issue 901082



Sign in to add a comment

X-Client-Data is not set on requests for service worker scripts.

Project Member Reported by falken@chromium.org, Jan 18 (5 days ago)

Issue description

It looks like X-Client-Data is not set on requests for the main service worker script. It is set correctly on requests for its import scripts.

Probably the main script load goes through the shadow page, while the ones are OffMT fetches?

Landing a test soon about this.
 

Comment 1 by falken@chromium.org, Jan 18 (4 days ago)

Components: Internals>Services>Network
Labels: Proj-Servicification Hotlist-KnownIssue
Owner: falken@chromium.org
Status: Assigned (was: Available)
It looks like the bug only happens with NetworkService on.

Comment 2 by falken@chromium.org, Jan 18 (4 days ago)

Labels: -Pri-2 Target-73 Pri-1

Comment 3 by falken@chromium.org, Jan 21 (2 days ago)

Blockedon: 538751
Yes looks like a shadow page issue.

Usually when NeworkService is on, requests from the renderer go through throttles via:
1. (frames) RenderFrameImpl::WillSendRequest calls
  extra_data->set_url_loader_throttles(
      render_thread->url_loader_throttle_provider()->CreateThrottles(
          routing_id_, request, resource_type));
2. (dedicated & shared workers) WebWorkerFetchContextImpl::WillSendRequest calls
  extra_data->set_url_loader_throttles(throttle_provider_->CreateThrottles(
        ancestor_frame_id_, request, WebURLRequestToResourceType(request)));
3. (service workers) ServiceWorkerFetchContextImpl::WillSendRequest calls
    extra_data->set_url_loader_throttles(throttle_provider_->CreateThrottles(
        MSG_ROUTING_NONE, request, WebURLRequestToResourceType(request)));

But for requests from the shadow page, we get to WorkerShadowPage::WillSendRequest which doesn't set up throttles. And WorkerShadowPage is in blink so doesn't have easy access to content::URLLoaderThrottleProvider.

So to fix this we either need to remove the shadow page or plumb URLLoaderThrottleProvider to blink.

Shared workers seem to work probably because PlzSharedWorker does the request from the browser.

Comment 4 by nhiroki@google.com, Jan 21 (2 days ago)

falken@: Do you think we should prioritize removing the shadow page? The issue for the shadow page is P2, but this is P1.

Comment 5 by falken@chromium.org, Jan 21 (2 days ago)

Not too sure. I might be able to onion soup URLLoaderThrottleProvider to make it work with the shadow page, but I'm not sure it's worth the effort if the shadow page will be removed anyway. On the  other hand, the worker fetch contexts probably need to be onion souped anyway, so URLLoaderThrottleProvider eventually will need onion souping...

How far off are we from removing the shadow page? Is it possible to happen by M73 or M74?

Comment 6 by falken@chromium.org, Jan 21 (2 days ago)

Ah, we might be able to hook in throttles using the shadow page's service worker network provider at WebServiceWorkerNetworkProviderImpl::WillSendRequest.

Comment 7 by nhiroki@chromium.org, Jan 21 (2 days ago)

> How far off are we from removing the shadow page? Is it possible to happen by M73 or M74?

To remove it, we need to make off-the-main-thread (OTMT) service worker script fetch available. For M73, I don't think we can finish it. For M74, it would still be hard even if we'll focus only on it. We haven't shipped even OTMT dedicated worker script fetch yet that is easier than OTMT service worker script fetch...

Comment 8 by falken@chromium.org, Jan 21 (2 days ago)

Status: Started (was: Assigned)
Thanks, I think we can do this without more onion soup or removing shadow page after all.

Comment 9 by nhiroki@chromium.org, Yesterday (26 hours ago)

Blockedon: -538751
Removed the dependency on issue 538751 (removing worker shadow page) based on c#8.

Sign in to add a comment