Re: [w3c/ServiceWorker] Should a service worker be allowed to register new service workers? (#1117)

asutherland left a comment (w3c/ServiceWorker#1117)

As an update for any future discussion, Firefox did ship a fully functional `navigator.serviceWorker` ServiceWorkerContainer in all workers including ServiceWorkers, and we implemented the lifetime mechanism discussed in https://github.com/w3c/ServiceWorker/issues/980#issuecomment-248920422 with the main notes that:
- We did not implement any heuristics along the lines of https://github.com/w3c/ServiceWorker/issues/980#issuecomment-314487339 that proposed that the SW might be kept alive by the existence of controlled clients.
- We do have a check [mozilla::dom::ServiceWorkerLifetimeExtension::LifetimeExtendsIntoTheFuture](https://searchfox.org/firefox-main/rev/4eb5d723d627edec42ca3e5d606e1227c656dfca/dom/serviceworkers/ServiceWorkerLifetimeExtension.h#61-71) that we use to ensure that there is some minimum amount of lifetime left for situations where we would potentially spawn a ServiceWorker.  Currently the constant used means that there needs to be 5 seconds of lifetime left.  This is partly because we do continue to have a grace period for ServiceWorkers and the lifetime mechanism is separate from that (for now).  But the grace periods don't allow an end-run around lifetime extensions; a SW in its grace period has no lifetime which it can grant to others.

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

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

Received on Friday, 3 July 2026 15:22:11 UTC