Open Bug 1244349 Opened 7 years ago Updated 1 year ago

Ensure push subscriptions are associated with an active service worker


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




Tracking Status
firefox47 --- affected


(Reporter: lina, Unassigned)


(Blocks 1 open bug)


(Whiteboard: dom-triaged) 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
Blocks: 1497427
Priority: -- → P3
Severity: normal → S4
You need to log in before you can comment on or make changes to this bug.