[webkit-changes] [WebKit/WebKit] 107874: Propagate aborted state to dependent signals befor...
Marais Rossouw
noreply at github.com
Fri Aug 16 20:42:19 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 107874a6f093539d8b84cffb0454e954c4e7dee6
https://github.com/WebKit/WebKit/commit/107874a6f093539d8b84cffb0454e954c4e7dee6
Author: Marais Rossouw <me at marais.co>
Date: 2024-08-16 (Fri, 16 Aug 2024)
Changed paths:
M LayoutTests/imported/w3c/web-platform-tests/dom/abort/abort-signal-any.any-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/dom/abort/abort-signal-any.any.worker-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/dom/abort/resources/abort-signal-any-tests.js
M Source/WebCore/dom/AbortSignal.cpp
M Source/WebCore/dom/AbortSignal.h
Log Message:
-----------
Propagate aborted state to dependent signals before firing events
https://bugs.webkit.org/show_bug.cgi?id=278159
Reviewed by Chris Dumez.
The implementation and spec assert that dependent signals are aborted
if any of their sources are aborted. However, the intermediate states do not
reflect this during the abort process. Since we iterate through all the dependent
signals, updating the state and then firing the event.
An updated spec is about to land to address this by first propagating
the abort state to any dependent signals, and only then run the
abort steps (run algorithms and fire events).
Worthy notes:
- Dependent signals do not themselves have dependent signals, which
means it's unnecessary to call "signal abort recursively".
- This approach retains the existing event dispatch order while
ensuring the abort state is synced before any JS runs.
DOM spec PR: https://github.com/whatwg/dom/pull/1295
* LayoutTests/imported/w3c/web-platform-tests/dom/abort/abort-signal-any.any-expected.txt: Rebaselined.
* LayoutTests/imported/w3c/web-platform-tests/dom/abort/abort-signal-any.any.worker-expected.txt: Rebaselined.
* LayoutTests/imported/w3c/web-platform-tests/dom/abort/resources/abort-signal-any-tests.js:
Ported wpt tests from Chromium's PR addressing this same concern. The
tests:
- `Dependent signals for ${desc} are marked aborted before abort events fire ${suffix}` and
- `Dependent signals for ${desc} are aborted correctly for reentrant aborts ${suffix}`.
* Source/WebCore/dom/AbortSignal.cpp:
(WebCore::AbortSignal::any):
`check-webkit-style` did not like the `findIf` with `[whitespace/newline]`.
(WebCore::AbortSignal::signalAbort):
Collect the dependent signals to abort into a vector, then
mark those as aborted, then
run the signal's abort steps, and finally
run the dependent signals' abort steps.
(WebCore::AbortSignal::markAborted):
Added this convenience method to set both the `reason` and then
`m_aborted` state.
(WebCore::AbortSignal::runAbortSteps):
* Source/WebCore/dom/AbortSignal.h:
Canonical link: https://commits.webkit.org/282387@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