Skip to content

Should InstallEvent.addRoutes reject if the the install event is not active? #1743

@youennf

Description

@youennf

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions