Re: [w3c/ServiceWorker] New "setup" lifecycle for service worker (#1576)

It's also worth calling out that WebExtensions can layer whatever additional semantics and state machines it wants onto its own API surfaces.  There's nothing stopping WebExtensions from, specified in its own standard, dispatching a functional event "webextSetup" which must complete before WebExtensions starts dispatching events at the tabs API.

I think the major issue is the "fetch" event, and at least in terms of Firefox's planned implementation of WebExt Service Workers, that won't be going through the normal fetch specification and "handle fetch" series of hooks.  Instead WebExtensions will directly dispatch a fetch event at the ServiceWorker.  The WebExtensions network layer ("channel" in Firefox/Necko) has complete control over when it dispatches this event and can internally wait for "webextSetup" or whatever it wants to happen before handing them off to the ServiceWorkers machinery.

Obviously, all of this could change with any standardization effort for WebExtensions, but @wanderview's complexity concerns would still hold in that case.  (And in general I do expect there to be some issues/potential conflicts resulting from WebExtensions' creation and evolution to use ServiceWorkers outside of any public standards efforts.)

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

Received on Tuesday, 6 April 2021 16:15:39 UTC