WebKit
7d575e9f - Default AbortSignal's reason to AbortError

Commit
1 year ago
Default AbortSignal's reason to AbortError https://bugs.webkit.org/show_bug.cgi?id=281961 Reviewed by Chris Dumez. The DOM specification for AbortSignal states that if no reason is provided, to default or fallback to a DOMException AbortError. This pull request moves this logic from the AbortController's abort method to AbortSignal's signalAbort method, where it rightly belongs. As specified in the AbortSignal spec, https://dom.spec.whatwg.org/#abortsignal-signal-abort, step 2: > Set signal's abort reason to reason if it is provided; otherwise, to a new "AbortError" DOMException. In contrast, the AbortController spec, https://dom.spec.whatwg.org/#abortcontroller which simply states: > The abort(reason) method steps are to signal abort on this with reason if it is provided. It does not mention the default behavior. Essentially, we're shifting this logic from AbortController:abort to its encapsulated AbortSignal:signalAbort method. * Source/WebCore/dom/AbortController.cpp: (WebCore::AbortController::abort): Removes default reason, to simply forward it to the encapsulated AbortSignal:signalAbort. * Source/WebCore/dom/AbortController.h: * Source/WebCore/dom/AbortController.idl: We should not "[CallWith=CurrentGlobalObject]" for the abort method, instead use the GlobalObject the controller was constructed with. * Source/WebCore/dom/AbortSignal.cpp: (WebCore::AbortSignal::signalAbort): Logic implemented as description reads. * Source/WebCore/dom/Subscriber.cpp: (WebCore::Subscriber::close): AbortController::abort no longer accepts a globalObject, so removed the callsite reference. * Source/WebCore/dom/InternalObserverFirst.cpp: AbortController::abort no longer accepts a globalObject, so removed the callsite reference. Canonical link: https://commits.webkit.org/285686@main
Author
Committer
Parents
Loading