mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.22k stars 22.5k forks source link

[WebAPI] Expose ServiceWorker in Workers #36532

Open Rumyra opened 3 weeks ago

Rumyra commented 3 weeks ago

Acceptance criteria

For folks helping with Firefox related documentation

Related Gecko bugs

https://bugzilla.mozilla.org/show_bug.cgi?id=1113522 https://bugzilla.mozilla.org/show_bug.cgi?id=1131324

Other

hamishwillee commented 3 weeks ago

My understanding is that this allows a service worker to get a handle to the service worker of the window that it is loaded into. With this it can get the registrations (the workers associated with the document in different tabs) and send each active registration a message to update itself.

Essentially this provides a mechanism that allows an updated service worker to send a message to all other tabs running the old version of itself, telling them to update to the latest version. This is cool because otherwise you have to wait for every tab to be shut down running the old version.

I still don't fully grok this, but there are some excellent documents on this here:

I'm trying to confirm state of play in https://bugzilla.mozilla.org/show_bug.cgi?id=1113522#c17

Status