Closed ghost closed 8 years ago
This is all frightfully obtuse, but if we consider subscriptions to be bound to or owned by registrations, then unregister()
already includes steps that would remove the subscription. It's transitive, but I interpret the last step of https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#clear-registration-algorithm to cover this. Well, it's all down to garbage collection, but that shouldn't be observable by script.
Am I missing something? I have to admit, it looks like the service work spec is designed to be maximally incomprehensible.
I'm happy to say the subscription is only removed when Clear Registration is finally run. And so the subscription is not removed while the uninstalling flag is set, but the registration is alive because of active clients.
As you say, its confusing. So I thought just clarifying the intent of the push spec in a non-normative note would be useful.
As @wanderview points out in https://bugzilla.mozilla.org/show_bug.cgi?id=1185716#c20, it's possible for a client to be using a service worker registration when it's removed. In that case, the registration is flagged, and can be restored or removed later.
It's unclear what to do with the push subscription in this case. Should it be removed unconditionally, even when the service worker still has clients? Or should it only be removed once all clients have gone away?