[w3c/ServiceWorker] ready promise is kind of weird with overlapping scopes (#1278)

Consider this situation:

```javascript
// Window foo.com/bar/baz/index.html
await navigator.serviceWorker.register('sw.js', { scope: '/bar' });

navigator.serviceWorker.ready.then(swr => {
  console.log(swr.scope);
});

await navigator.serviceWorker.register('sw.js', { scope: '/bar/baz' });

navigator.serviceWorker.ready.then(swr => {
  console.log(swr.scope);
});
```

The first ready promise gets the '/bar' scope registration and waits for it to activate.  This is step 4.3 of here:

https://w3c.github.io/ServiceWorker/#navigator-service-worker-ready

Assuming that the '/bar' worker does not activate immediately, we might get the '/bar/baz' worker registration started.

What should the second `.ready` promise access do?  The promise is not settled yet, but the previous access is in a parallel bit of algorithm waiting for '/bar' to activate.  Should the second access block on that somehow or start waiting on '/bar/baz' instead?

Kind of a corner case, but its a bit weird.

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

Received on Friday, 9 February 2018 21:49:29 UTC