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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

</pre>

<style>
Expand Down Expand Up @@ -262,7 +263,8 @@ The <dfn attribute for=Subscriber><code>signal</code></dfn> getter steps are to
</div>

<div algorithm>
To <dfn>close a subscription</dfn> given a {{Subscriber}} |subscriber|, run these steps:
To <dfn>close a subscription</dfn> given a {{Subscriber}} |subscriber|, and
an optional {{any}} |reason|, run these steps:

1. If |subscriber|'s [=Subscriber/active=] is false, then return.

Expand Down Expand Up @@ -292,9 +294,10 @@ observable.subscribe({}, {signal: outerController.signal});

1. Set |subscriber|'s [=Subscriber/active=] boolean to false.

1. [=AbortSignal/Signal abort=] |subscriber|'s [=Subscriber/subscription controller=].
1. [=AbortSignal/Signal abort=] |subscriber|'s [=Subscriber/subscription controller=]
with |reason|, if it is given.

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.


1. [=list/For each=] |teardown| of |subscriber|'s [=Subscriber/teardown callbacks=] sorted in
reverse insertion order:
Expand Down Expand Up @@ -527,12 +530,14 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
1. If |options|'s {{SubscribeOptions/signal}} [=map/exists=], then:

1. If |options|'s {{SubscribeOptions/signal}} is [=AbortSignal/aborted=], then [=close a
subscription|close=] |subscriber|.
subscription|close=] |subscriber| given |options|'s {{SubscribeOptions/signal}}
[=AbortSignal/reason=].

1. Otherwise, [=AbortSignal/add|add the following abort algorithm=] to |options|'s
{{SubscribeOptions/signal}}:

1. [=close a subscription|Close=] |subscriber|.
1. [=close a subscription|Close=] |subscriber| with |options|'s
{{SubscribeOptions/signal}} [=AbortSignal/reason=].

1. If [=this=]'s [=Observable/subscribe callback=] is a {{SubscribeCallback}}, [=invoke=] it
with |subscriber|.
Expand Down
Loading