- From: Ben Kelly <notifications@github.com>
- Date: Fri, 09 Feb 2018 14:31:05 -0800
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/issues/1279@github.com>
Consider this:
```javascript
// These should both evaluate to the same registration...
await navigator.serviceWorker.register('sw.js', { scope: './' });
let swr = await navigator.serviceWorker.ready;
// unregister and drop our ref
await swr.unregister();
swr = null;
// the registration should not be accessible with getRegistration() any more
swr = await navigator.serviceWorker.getRegistration('./');
assert_equal(swr, null);
// the ready promise continues to resolve the old registration, even
// if there are no controlled clients.
swr = await navigator.serviceWorker.ready;
assert_true(swr);
// I think the workers are all gone, though??
assert_equal(swr.installing, null);
assert_equal(swr.waiting, null);
assert_equal(swr.active, null);
// register a new service worker
let swr2 = await navigator.serviceWorker.register('sw.js', { scope: './' });
let swr3 = await navigator.serviceWorker.ready;
// the ready promise should not change since its settled
assert_equal(swr, swr3);
// but the register() call should result in a new registration since the
// old one was not kept alive by any controlled clients
assert_not_equal(swr, swr2);
```
Does this make sense to developers? I find it really weird. Related to #1278.
--
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/1279
Received on Friday, 9 February 2018 22:31:29 UTC