- From: Ben Kelly <notifications@github.com>
- Date: Tue, 29 Sep 2020 14:18:25 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 29 September 2020 21:18:38 UTC
Consider a service worker script that looks like: ```javascript self.addEventListener('fetch', evt => { evt.respondWith(fetch(evt.request)); }); ``` And that the controlled page does the following: ```javascript const controller = new AbortController(); fetch(url, { signal: controller.signal }); if (some_condition) { controller.abort(); } ``` Should the fetch() initiated by the service worker script be aborted in this case? I think it would be good to do so. I'm unsure this is what the spec says, though. It seems that in Handle Fetch we create a `Request` from an inner `request` in step 21.3.2: https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm The fetch spec, however, does not have an abort signal on the inner request: https://fetch.spec.whatwg.org/#concept-request Its only present on the exposed `Request` object: https://fetch.spec.whatwg.org/#request-signal This implies that Handle Fetch effectively strips the AbortSignal from the request when generating FetchEvent.request. Is that intentional? -- 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/1544
Received on Tuesday, 29 September 2020 21:18:38 UTC