Description
Consider a service worker script that looks like:
self.addEventListener('fetch', evt => {
evt.respondWith(fetch(evt.request));
});
And that the controlled page does the following:
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?