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

Pass abortsignal reason to close a subscription #166

Merged
merged 3 commits into from
Aug 13, 2024

Conversation

keithamus
Copy link
Collaborator

@keithamus keithamus commented Jul 27, 2024

Fixes #165.

This seems to marry up with Chrome's impl:

    if (downstream_signal->aborted()) {
      CloseSubscription(
          script_state,
          /*abort_reason=*/downstream_signal->reason(script_state));
    } else {
      close_subscription_algorithm_handle_ = downstream_signal->AddAlgorithm(
          MakeGarbageCollected<CloseSubscriptionAlgorithm>(
              this, downstream_signal, script_state));
    }

Preview | Diff

@keithamus keithamus requested a review from domfarolino July 27, 2024 20:47
@keithamus keithamus force-pushed the pass-abortsignal-reason-to-close-a-subscription branch 2 times, most recently from 2e0a937 to 85e4753 Compare July 27, 2024 20:51
@keithamus keithamus force-pushed the pass-abortsignal-reason-to-close-a-subscription branch from 85e4753 to c1ac731 Compare July 27, 2024 20:54
spec.bs Outdated
@@ -37,6 +37,7 @@ urlPrefix: https://dom.spec.whatwg.org; spec: DOM
for: AbortSignal
text: dependent signals; url: abortsignal-dependent-signals
text: signal abort; url:abortsignal-signal-abort
text: reason; url:abortsignal-abort-reason
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to double check, is this needed? I guess it is, but I'm surprised by this. It makes me wonder if we're holding AbortSignal wrong — I would expect this to be exported so other specs that use AbortSignals can propagate reasons similarly.

spec.bs Outdated

Issue: Abort with an appropriate abort reason.
Issue: Abort with an appropriate abort reason if none given.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is needed at all now. We don't need to supply a "fallback" default reason if none was provided.

@domfarolino domfarolino changed the title pass abortsignal reason to close a subscription Pass abortsignal reason to close a subscription Aug 13, 2024
@domfarolino
Copy link
Collaborator

I cleaned a few things up here. I think it's good to go now so I'll merge.

@domfarolino domfarolino merged commit d5a14ab into master Aug 13, 2024
2 checks passed
@domfarolino domfarolino deleted the pass-abortsignal-reason-to-close-a-subscription branch August 13, 2024 17:08
github-actions bot added a commit that referenced this pull request Aug 13, 2024
SHA: d5a14ab
Reason: push, by domfarolino

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Closing subscriptions with AbortSignal reasons
2 participants