should FetchEvent.request.signal reflect abort status of outer request?
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 3.6k
- Forks
- 324
- Avg merge
- 14d 22h
- Merged PRs (30d)
- 1
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Service Worker Handle Fetch and on-fetch-request algorithms linked in the issue, then compare them with Fetch's concept-request and request-signal sections. The issue is done when the specification clearly resolves whether abort status from the outer request must be reflected in FetchEvent.request and the resulting service-worker fetch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100