New issue
Advanced search Search tips

Issue 605917 link

Starred by 0 users

Issue metadata

Status: Duplicate
Merged: issue 592188
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocking:
issue 592188



Sign in to add a comment

Resources loaded via WorkerThreadableLoader not intercepted by service workers

Project Member Reported by mvanouwe...@chromium.org, Apr 22 2016

Issue description

Resources loaded via WorkerThreadableLoader are not intercepted by service workers.

This means that the icons for push notifications cannot be offlined. The loading is performed from NotificationResourcesLoader, as implemented in https://codereview.chromium.org/1847863002/.

There is a test that exercises this case in serviceworkerregistration-service-worker-fetch-resources.html in https://codereview.chromium.org/1909043003/.

Assigning to Kinuko for triage. Are we using ThreadableLoader incorrectly, or is there maybe a bug in ThreadableLoader?
 
Blocking: 592188
Kinuko, could you take a look please?
Cc: kinuko@chromium.org
Owner: horo@chromium.org
Status: Assigned (was: Untriaged)
horo@, would you take a look at this?

Comment 5 by horo@chromium.org, May 12 2016

Status: WontFix (was: Assigned)
The network requests from the ServiceWorker shouldn't fire the fetch event in the ServiceWorker.

According to the fetch spec:
> https://fetch.spec.whatwg.org/#http-fetch
> 5.3 HTTP fetch
>  1. Let response be null.
>  2. Let actualResponse be null.
>  3. If request's skip-service-worker flag is unset and either request's client is null or request's client's global object is not a ServiceWorkerGlobalScope object, run these substeps: [HTML] [SW]
>    1. Set response to the result of invoking handle fetch for request. [SW]
>    2. ...

When the ServiceWorker script calls showNotification(), the request's client's global object is the ServiceWorkerGlobalScope object.
So the fetch request should not be handled in the ServiceWorker.

I think the ServiceWorker script should use data URLs for icon resources.
Cc: jakearchibald@chromium.org
Status: Assigned (was: WontFix)
I'm sorry, I think there is still a problem we can solve here. It is normal for notifications to be shown from a service worker, and it's also normal to use regular urls, not data urls. If it helps, the m_skipServiceWorker is set to false on ResourceRequest [1].

Note that these are not fetches initiated directly from script, they are initiated by Chrome internally in order to load a notification's resources.

Jake, do you know if this is possible within the current spec, or would we need to carve out space for this type of use case in the spec?

[1] https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/platform/network/ResourceRequest.cpp&cl=GROK&l=410
I filed an issue on the fetch spec to clarify this: https://github.com/whatwg/fetch/issues/303
Labels: -Pri-2 Pri-3
Status: ExternalDependency (was: Assigned)
Seems like this is blocked on https://github.com/whatwg/fetch/issues/303

Comment 9 by peter@chromium.org, Jul 4 2017

Mergedinto: 592188
Status: Duplicate (was: ExternalDependency)
Let's track the rest of this in Issue 592188.

Sign in to add a comment