WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
246069
Use AbortSignal.reason in Fetch code
https://bugs.webkit.org/show_bug.cgi?id=246069
Summary
Use AbortSignal.reason in Fetch code
nidhijaju
Reported
2022-10-05 00:23:15 PDT
In
https://github.com/whatwg/fetch/pull/1343
, the Http-network fetch and fetch() method have been updated to use AbortSignal's abort reason (or a serialized version of it) when erroring streams and aborting the fetch() call, rather than unconditionally using an AbortError. This change also includes using the abort reason to abort the fetch controller. There are some related changes in the Service Worker spec in
https://github.com/w3c/ServiceWorker/pull/1655
. When a service worker intercepts a fetch request, the signal's abort reason is passed to the service worker to abort the fetch controller and signal abort in the Handle Fetch algorithm. The same change needs to be made to the Safari implementation.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2022-10-12 00:24:18 PDT
<
rdar://problem/101068136
>
Frederick Zhang
Comment 2
2025-02-02 20:56:03 PST
I'm using Safari 18.2 and it still has this issue. Interestingly, if a signal is already aborted before fetch(), there seems to be some early-return logic and it actually copies the reason in this case: let c = new AbortController() c.abort('Foo') fetch('
https://example.com
', { signal: c.signal }).catch(e => console.debug({e, name: e.name, message: e.message})).then(res => console.debug(res)) // output: {e: "Foo", name: undefined, message: undefined} let s = AbortSignal.timeout(0) fetch('
https://example.com
', { signal: s }).catch(e => console.debug({e, name: e.name, message: e.message})).then(res => console.debug(res)) // output: {e: TimeoutError: The operation timed out., name: "TimeoutError", message: "The operation timed out."}
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug