[webkit-changes] [WebKit/WebKit] 7d575e: Default AbortSignal's reason to AbortError
Marais Rossouw
noreply at github.com
Thu Oct 24 21:09:18 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7d575e9f5b200225c8feb627db492ee92ad1e5b6
https://github.com/WebKit/WebKit/commit/7d575e9f5b200225c8feb627db492ee92ad1e5b6
Author: Marais Rossouw <me at marais.co>
Date: 2024-10-24 (Thu, 24 Oct 2024)
Changed paths:
M Source/WebCore/dom/AbortController.cpp
M Source/WebCore/dom/AbortController.h
M Source/WebCore/dom/AbortController.idl
M Source/WebCore/dom/AbortSignal.cpp
M Source/WebCore/dom/InternalObserverFirst.cpp
M Source/WebCore/dom/Subscriber.cpp
Log Message:
-----------
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
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list