[ServiceWorker] unregister() in service worker navigation fetch event (#804)

Consider this case:

```
addEventListener('fetch', function(evt) {
  fetch.respondWith(self.registration.unregister().then(function() {
    return new Response('foo');
  });
});
```

If this is the first navigation for this scope, then there may be no controlled clients.  This means the unregister() can kill the current worker before it completes the fetch event.

This leaves things in a bit of a messy state because .respondWith() was called, but the worker died before it completed.

This is kind of a corner case, but it would be nice to understand the desired behavior here.  Should we simply fall back to a normal network load?  Or should we keep the worker alive until the fetch event is complete?  Imagine if someone wanted to call register() after the unregister().

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/804

Received on Wednesday, 23 December 2015 04:01:09 UTC