Re: [w3c/ServiceWorker] "Unregister" operation may be interrupted by `ServiceWorker#postMessage` (#1146)

> At least, all of the them check if the registration's uninstalling flag is set before they invoke Try Clear Registration. But that's not enough to avoid them race, right?

I think those places are mostly right for checking the installing flag.  The steps that call them probably need to be executed on the thread managing the job queue, though.  Right now they are on the worker thread in the spec.

> Could you get a little more specific on this? I'd like to think about this option together.

I was just saying methods on the ServiceWorker and ServiceWorkerRegistration objects can probably check the uninstalling flag in order to trigger any "don't allow this on an uninstalling service worker" logic.

Another perspective, though, is that as long as a page has the ServiceWorker DOM object referenced and the service worker is not in the redundant state, then the methods on that object should work.  Maybe we should permit postMessage() in this case.  If something is listed as `registration.active` that certainly suggests it should be usable.

With that approach we would base the "don't allow this on an uninstalling service worker" based on the service worker's state (redundant, etc).  This would be the least racy, but would allow postMessage() while waiting for the active worker to go idle.

This is where I'm not sure what semantics make most sense for developers.

-- 
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/1146#issuecomment-305504050

Received on Thursday, 1 June 2017 14:09:14 UTC