Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbortSignal: Propagate aborted state to dependent signals before firing events #47653

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Aug 16, 2024

The implementation and spec of dependent signals assumes and asserts that a dependent signal is aborted if any of its sources have been
aborted. But this property does not hold during the abort process, since
intermediate states of abort propagation can be observed. For example,
calling AbortSignal.any([signal]) in an "abort" event listener for one
of signal's sources is a way to observe intermediate state, since the
"abort" event fires before the source signal's dependents are updated.

To fix this, this CL decouples setting the abort state and reacting to
abort event:

  1. Mark the source signal as aborted
  2. Propagate the aborted state to any dependent signals
  3. Run abort steps (run algorithms, fire events) for the source signal
  4. Run abort steps for each of the dependent signals

PR: whatwg/dom#1295

Change-Id: I65a97eb46b01a0071d661e945f64c90e33954088
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5664649
Commit-Queue: Scott Haseley <[email protected]>
Reviewed-by: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1344364}

…ng events

The implementation and spec of dependent signals assumes and asserts that a dependent signal is aborted if any of its sources have been
aborted. But this property does not hold during the abort process, since
intermediate states of abort propagation can be observed. For example,
calling AbortSignal.any([signal]) in an "abort" event listener for one
of signal's sources is a way to observe intermediate state, since the
"abort" event fires before the source signal's dependents are updated.

To fix this, this CL decouples setting the abort state and reacting to
abort event:
 1. Mark the source signal as aborted
 2. Propagate the aborted state to any dependent signals
 3. Run abort steps (run algorithms, fire events) for the source signal
 4. Run abort steps for each of the dependent signals

PR: whatwg/dom#1295

Change-Id: I65a97eb46b01a0071d661e945f64c90e33954088
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5664649
Commit-Queue: Scott Haseley <[email protected]>
Reviewed-by: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1344364}
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 07a9d09 into master Aug 20, 2024
15 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-5664649 branch August 20, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants