Re: [whatwg/dom] Add abort reason to AbortSignal (PR #1027)

@yutakahirano commented on this pull request.



>  
 <ol>
  <li><p>Let <var>signal</var> be a new {{AbortSignal}} object.
 
  <li><p>Set <var>signal</var>'s [=AbortSignal/aborted flag=].
 
+ <li><p>If <var>reason</var> is undefined or not given, then let <var>reason</var> be a new

I think "is not given" is enough (i.e., we don't need "is undefined").

>  
 <ol>
  <li><p>If <var>signal</var>'s [=AbortSignal/aborted flag=] is set, then return.
 
  <li><p>Set <var>signal</var>'s [=AbortSignal/aborted flag=].
 
+ <li><p>If <var>reason</var> is undefined or not given, then let <var>reason</var> be

Ditto (let vs. set)

> @@ -1836,13 +1856,18 @@ service worker.
 them. For instance, if the operation has already completed.
 
 <p>To <dfn export for=AbortSignal>signal abort</dfn>, given an {{AbortSignal}} object
-<var>signal</var>, run these steps:
+<var>signal</var> and an optional abort <var>reason</var>, run these steps:

Maybe "and an optional _reason_" is enough.

> @@ -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 ignore>reason</var> in this object's {{AbortSignal}}'s [=AbortSignal/abort reason=], and

Do we need "the" for `<var ignore>reason</var>`?

>    attribute EventHandler onabort;
 };</pre>
 
 <dl class=domintro>
- <dt><code>AbortSignal . <a method for="AbortSignal">abort()</a></code>
- <dd>Returns an {{AbortSignal}} instance whose <a for=AbortSignal>aborted flag</a> is set.
+ <dt><code>AbortSignal . <a method for=AbortSignal>abort</a>(reason)</code>
+ <dd>Returns an {{AbortSignal}} instance whose <a for=AbortSignal>aborted flag</a> is set, and
+ <a for=AbortSignal>abort reason</a> is set to <var>reason</var> if provided, otherwise to
+ "{{AbortError!!exception}}" {{DOMException}}.

an "AbortError" DOMException.

>    attribute EventHandler onabort;
 };</pre>
 
 <dl class=domintro>
- <dt><code>AbortSignal . <a method for="AbortSignal">abort()</a></code>
- <dd>Returns an {{AbortSignal}} instance whose <a for=AbortSignal>aborted flag</a> is set.
+ <dt><code>AbortSignal . <a method for=AbortSignal>abort</a>(reason)</code>
+ <dd>Returns an {{AbortSignal}} instance whose <a for=AbortSignal>aborted flag</a> is set, and
+ <a for=AbortSignal>abort reason</a> is set to <var>reason</var> if provided, otherwise to
+ "{{AbortError!!exception}}" {{DOMException}}.
+
+ <dt><code><var>signal</var> . <a attribute for=AbortSignal>reason</a></code>
+ <dd>Returns the <a for=AbortSignal>abort reason</a> for an {{AbortSignal}} if it has been

I think we don't need "if it has been set...".

>  
 <ol>
  <li><p>Let <var>signal</var> be a new {{AbortSignal}} object.
 
  <li><p>Set <var>signal</var>'s [=AbortSignal/aborted flag=].
 
+ <li><p>If <var>reason</var> is undefined or not given, then let <var>reason</var> be a new

I believe we use "set _x_ to _y_" rather than "let _x_ be _y_" for substitution to an existing variable.

>  
 <ol>
  <li><p>If <var>signal</var>'s [=AbortSignal/aborted flag=] is set, then return.
 
  <li><p>Set <var>signal</var>'s [=AbortSignal/aborted flag=].
 
+ <li><p>If <var>reason</var> is undefined or not given, then let <var>reason</var> be

Ditto (is undefined)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1027#pullrequestreview-785167048

Received on Thursday, 21 October 2021 03:33:28 UTC