[w3c/ServiceWorker] Should InstallEvent.addRoutes reject if the the install event is not active? (Issue #1743)

Currently, it is possible to call addRoutes while the service worker is no longer installing.
I am wondering what the rationale for this decision is.

In that specific case, there is no guarantee that a route will be stored persistently (the service worker could have been stopped just after addRoutes is called).
When run again, the service worker has no way to know which of these after-installing service worker routes will actually be applied.

This is probably an edge case, but I am wondering whether it would be safer to call `add lifetime promise` within addRoutes.
This would have two effects:
1. Guarantee that addRoutes promise is rejected if the service worker is not installing.
2. Guarantee that the service worker will go to installed state after the route is properly stored (without developers having to explicitly call `waitUntil`).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1743
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/issues/1743@github.com>

Received on Tuesday, 21 January 2025 08:12:21 UTC