Re: [w3c/ServiceWorker] Clarification on what happens during a terminated activation (#1372)

Well backing up a bit, this issue is only about `activate` and not `install`. `install` definitely has a notion of failing. If `install` failed to finish successfully, that worker will be discarded instead of ever becoming active. `activate` has no (in the spec) notion of failing. Once `activate` starts, that worker is already the active worker and is committed to reaching the `activated` state and start receiving events.

> If Edge's behavior were implemented everywhere, would we just have to check for temporary cache entries that need to be cleaned up each time the service worker starts up?

Yes, I think that's right. The Edge behavior *is* implemented by Chrome too (at least, that's the intent), and is the currently specified behavior. It's only when activation was interrupted by browser shutdown that Chrome might re-run the event handler. So I think sites already needed to deal with the Edge behavior.

My plan is to teach Chrome to not start the activate handler if browser shutdown is what triggered activation (i.e., by closing the last tab that was using the incumbent worker). There is not much spec work required, except perhaps to add some text that browsers might delay `activate` if they don't expect to be able to finish the event, e.g, because it's during browser shutdown. 

-- 
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/1372#issuecomment-447320938

Received on Friday, 14 December 2018 13:11:41 UTC