Re: [w3c/ServiceWorker] consider allowing multiple worker thread instances for a single registration (#756)

> I'm happy to open the spec up to allow multiple worker instances, and UAs deal with the compatibility issues. We could issue a console warning on writing to the global after initial execution, but I don't know how effective that will be. Apple is probably in the best situation here, as I imagine devs will fix their stuff to get it working on iPhones. If multi-instance fails to show actual benefits in practice, we can remove it from the spec.

I can't help but feel this kind of punts the compat issue to developers.  We can't decide what to do, so lets let each browser vendor do whatever they want and leave it to developers to make their stuff work.  That seems a bit less than desirable to me.

I'd rather we be more explicit.  For example, to satisfy Microsoft's request for separate push/bg-sync threads we could:

1. Expose a `ServiceWorker` attribute that represents the push thread.  Something like `reg.pushManager.active`.
2. Expose a `ServiceWorker` attribute that represents the bg-sync thread.  Something like `reg.sync.active`.
3. Create a `ServiceWorker.version` UUID value or other model for the current service worker version.
4. Require that `controller.version === reg.active.version === reg.pushManager.active.version === reg.sync.active.version`.
5. Require that `controller === reg.active`.
6. Require `controller !== reg.pushManager.active !== reg.sync.active`.

This would support MS's request (I think) and expose what is going on to developers without "magic".

-- 
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/756#issuecomment-243210302

Received on Monday, 29 August 2016 18:26:07 UTC