Re: [w3c/ServiceWorker] resurrected service workers don't fire an activate event which may break expectations (#1204)

> What does this mean exactly? How does this happen?

When you call `unregister()` on a registration with an active worker that is still controlling clients, then the worker doesn't die immediately.  It gets an uninstalling flag and will normally go away once the last client closes.  If someone calls register() with the same params before that happens, though, then SW is "resurrected".  We just remove the uninstalling flag and let it keep on living.  While the uninstalling flag is set, though, the worker misses out on controlling clients, doesn't show in getRegistrations(), etc.

> I think that makes sense, this is a hard edge case for many developers to reason about. I do think that if we fire 'activate' again that we probably want to fire 'install' again too. I could see developers getting confused about 'activate' firing in this case but not 'install'.

Well, if we are going to do that, maybe we should just get rid of resurrection completely and make a new installing worker in this case.  Once a worker is doomed as uninstalling it would never come back.

Also, right now we have an invariant that SW firing the install event are reg.installing.  That wouldn't hold for what you are proposing here and could break things.  (Unlikely, though.)

-- 
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/1204#issuecomment-334896981

Received on Saturday, 7 October 2017 00:17:57 UTC