[w3c/ServiceWorker] ready promise doesn't work right when controlling registration is resurrected (#1198)

I was debugging some intermittent failures in our tests when I noticed some strange behavior. Consider:

```
  // start with a service worker
  let reg = await navigator.serviceWorker.register(script);
  await waitForState(reg.installing, "activated");

  // get a controlled document to hold the worker alive
  let frame = await withIframe(controlledURL);

  // mark the registration as uninstalling, but it won't
  // fully uninstall because of the frame
  await reg.unregister();
  
  // get the ready promise while in the uninstalling state
  let readyPromise = navigator.serviceWorker.ready;

  // register the service worker again, resurrecting the currently
  // active worker
  await navigator.serviceWorker.register(script);

  // this will never resolve
  await readyPromise;
```

I also wrote up a glitch to test this:

https://sw-ready-resurrection.glitch.me/

It seems both firefox and chrome have this problem.  I think we should resolve the ready promise if we resurrect an uninstalling registration controlling the page with an active worker.

-- 
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/1198

Received on Thursday, 21 September 2017 19:50:10 UTC