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

Add abort reason to AbortSignal #1027

Merged
merged 20 commits into from
Nov 8, 2021
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
21 changes: 16 additions & 5 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,7 @@ interface AbortController {

[SameObject] readonly attribute AbortSignal signal;

undefined abort();
undefined abort(optional any reason = null);
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved
};
</pre>

Expand All @@ -1741,8 +1741,9 @@ interface AbortController {
<dt><code><var>controller</var> . <a attribute for=AbortController>signal</a></code>
<dd>Returns the {{AbortSignal}} object associated with this object.

<dt><code><var>controller</var> . <a method for=AbortController lt=abort()>abort</a>()</code>
<dd>Invoking this method will set this object's {{AbortSignal}}'s [=AbortSignal/aborted flag=] and
<dt><code><var>controller</var> . <a method for=AbortController lt=abort()>abort</a>(reason)</code>
<dd>Invoking this method will set this object's {{AbortSignal}}'s [=AbortSignal/aborted flag=],
store the <var>reason</var> in this object's {{AbortSignal}}'s [=AbortSignal/abort reason=], and
signal to any observers that the associated activity is to be aborted.
</dl>

Expand All @@ -1762,8 +1763,10 @@ constructor steps are:
<p>The <dfn attribute for=AbortController><code>signal</code></dfn> getter steps are to return
<a>this</a>'s <a for=AbortController>signal</a>.

<p>The <dfn method for=AbortController><code>abort()</code></dfn> method steps are to
<a for=AbortSignal>signal abort</a> on <a>this</a>'s <a for=AbortController>signal</a>.
<p>The <dfn method for=AbortController><code>abort(reason)</code></dfn> method steps are to
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved
<a for=AbortSignal>signal abort</a> on <a>this</a>'s <a for=AbortController>signal</a>, with
the provided <var>reason</var>. If a <var>reason</var> is not passed, create a new "{{AbortError!!exception}}"
{{DOMException}}.
annevk marked this conversation as resolved.
Show resolved Hide resolved


<h3 id=interface-AbortSignal>Interface {{AbortSignal}}</h3>
Expand All @@ -1775,6 +1778,8 @@ interface AbortSignal : EventTarget {

readonly attribute boolean aborted;

readonly attribute any reason;
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved

attribute EventHandler onabort;
};</pre>

annevk marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -1790,6 +1795,9 @@ interface AbortSignal : EventTarget {
<p>An {{AbortSignal}} object has an associated <dfn export for=AbortSignal>aborted flag</dfn>. It is
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

FYI, this broke the builds of specs that use the aborted flag. No objections to the change; we just need to keep looking for better ways to do this sort of migration.

Copy link
Member

Choose a reason for hiding this comment

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

Let's continue to discuss in #1030.

unset unless specified otherwise.

<p>An {{AbortSignal}} object has an associated <dfn export for=AbortSignal>abort reason</dfn>, which is an
argument given to {{AbortController}}'s {{AbortController/abort()}}, or undefined.
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved

<p>An {{AbortSignal}} object has associated <dfn for=AbortSignal>abort algorithms</dfn>, which is a
<a for=/>set</a> of algorithms which are to be executed when its [=AbortSignal/aborted flag=] is
set. Unless specified otherwise, its value is the empty set.
Expand Down Expand Up @@ -1826,6 +1834,9 @@ service worker.
<p>The <dfn attribute for=AbortSignal>aborted</dfn> getter steps are to return true if <a>this</a>'s
[=AbortSignal/aborted flag=] is set; otherwise false.

<p>The <dfn attribute for=AbortSignal>reason</dfn> getter steps are to return <a>this</a>'s
<a for=AbortSignal>abort reason</a>.

<p>The <dfn attribute for=AbortSignal><code>onabort</code></dfn> attribute is an
<a>event handler IDL attribute</a> for the <dfn export for=AbortSignal><code>onabort</code></dfn>
<a>event handler</a>, whose <a>event handler event type</a> is
Expand Down