- From: Matt Falkenhagen <notifications@github.com>
- Date: Thu, 14 Mar 2019 08:19:03 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 14 March 2019 15:19:25 UTC
Should this respondWith() throw?
```
self.addEventListener('fetch', e => {
Promise.resolve().then(() => {
e.respondWith(new Response('respondWith succeeded'));
});
```
Firefox and Chrome have different behavior here. Demo site at
https://respond-with-microtask.glitch.me/
(Chrome Canary throws an exception and then crashes, sorry, just ignore the crash for now.)
In Chrome we tried hard to make it so respondWith()/waitUntil() can't be called like this, now I'm wondering whether the spec allows it after all.
The respondWith() spec steps check whether the dispatch flag is set: https://dom.spec.whatwg.org/#dispatch-flag
It's not clear to me if the dispatch flag gets unset before microtasks are run at the end of the event handler.
--
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/1394
Received on Thursday, 14 March 2019 15:19:25 UTC