Re: [w3c/ServiceWorker] More clarity around waiting for an active worker to finish (#916)

Status update: https://github.com/w3c/ServiceWorker/commit/f1a1120ff07120a2e8f311fb61f429c9a74db1ef addressed the resolution in https://github.com/w3c/ServiceWorker/issues/916#issuecomment-236021170 by introducing Try Activate.

There are still two remaining issues from @wanderview's follow-up comments. I plan to do:
1. Make sure to wait until workers are idle before clearing registration: https://github.com/w3c/ServiceWorker/issues/916#issuecomment-237272060 and https://github.com/w3c/ServiceWorker/issues/916#issuecomment-237275132.
 * There are three call sites to Clear Registration: Handle Client Unload, extension promises' fulfillment handlers, Handle User Agent Shutdown. I think we can introduce Try Clear Registration that invokes Clear Registration only when (registration's not used && relevant workers are idle) && unregister flag is set (Handle User Agent Shutdown shouldn't need this condition.)
 * When both unregister and Activate need to be checked, unregister has a priority over Activate.
2. Make sure to not loose any events scheduled to dispatch on the active worker in the activating state: https://github.com/w3c/ServiceWorker/issues/916#issuecomment-237681834.
 * Agree to delay the activation of the new one. When Handle Fetch is waiting to dispatch an event already, that means the client is already controlled by the existing active worker in activating state. So, delaying the activation of the new one seems to make the behavior consistent.

-- 
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/916#issuecomment-281274267

Received on Tuesday, 21 February 2017 08:18:17 UTC