Closed azaika closed 9 months ago
Thanks for filing the issue. That is an area that the explainer has not considered yet.
When I wrote https://github.com/WICG/service-worker-static-routing-api#how-does-it-work-with-empty-fetch-listeners, I supposed source
would be network
, and thought no fetch handlers or an empty fetch handlers are ignorable. However, considering cache
, we cannot.
I think https://github.com/yoshisatoyanagisawa/ServiceWorker/pull/2 covers the way to deal with the no fetch handler case.
Chromium implementation must be fixed to deal with the cases. It is tracked in crbug.com/1511459.
After the static routing API is introduced, service worker registrations can be like the following:
This code expects all
GET
request to refer the service worker cache and does not register any fetch handlers.However, it seems that the current ServiceWorker spec [1] does not consider the situation where no fetch handlers are registered. For example, the "Handle Fetch" algorithm of the spec [2] stipulates that:
This means that service workers do not work if web developers do not write their own fetch handlers, and at least, the "Should Skip Event" algorithm should be updated.
[1] https://w3c.github.io/ServiceWorker/ [2] https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm