Open Bug 1244349 Opened 9 years ago Updated 3 years ago

Ensure push subscriptions are associated with an active service worker

Categories

(Core :: DOM: Notifications, defect, P3)

defect

Tracking

()

Tracking Status
firefox47 --- affected

People

(Reporter: lina, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: dom-triaged)

https://w3c.github.io/push-api/#pushmanager-interface says we should wait until the service worker registration has an active worker before creating a subscription, but we don't actually enforce that. It's possible to register a worker, capture its `PushManager`, unregister, and create subscriptions like so: let pushManager; navigator.serviceWorker.register("./sw.js").then(registration => { pushManager = registration.pushManager; return registration.unregister(); }).then(_ => { return pushManager.subscribe(); }).then(subscription => { // Created subscription without active worker. }); We should wait until the worker is active, and, once the registration is removed, `pushManager.subscribe()` should reject with an InvalidStateError.
Whiteboard: dom-triaged
Another issue is that a push subscription can be created by a non-active worker. See https://github.com/w3c/push-api/issues/221.
Blocks: 1497427
Priority: -- → P3
Severity: normal → S4
You need to log in before you can comment on or make changes to this bug.