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

Thanks for reviewing to this detail. [Unregister](https://w3c.github.io/ServiceWorker/#unregister) algorithm being invoked means the update job is scheduled and run. So, we set the [uninstalling flag](https://w3c.github.io/ServiceWorker/#dfn-uninstalling-flag) to not allow getting this registration or running any action on it from this point. (Only a scheduled register job can flip this.) Also, we try to clear registration at the earliest possible (via Try Clear Registration in many points where the registration's workers are idle.)

But as you pointed, we missed this right within the Unregister algorithm itself. I think we should invoke Try Clear Registration before invoking Resolve Job Promise. That'll make the resolve task will be scheduled after the tasks that mutate the states. Then, the unregister() promise's settlement callbacks when scheduled will see the active worker became redundant. So, I think the expected behavior here should be postMessage() throw an "InvalidStateError". WDYT?

-- 
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-305111102

Received on Wednesday, 31 May 2017 07:41:28 UTC