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 might be misunderstanding but isn't "undefined" and "not given" (i.e. "missing") two different things so we should check for both?

I may be wrong too, but IIUC they are different, and the IDL processor converts `undefined` to the special value "missing" at described in https://webidl.spec.whatwg.org/#es-overloads. Hence when we call `controller.abort(undefined)` from the script we see missing _reason_ here, so I **think** we don't need to deal with `undefined` here.

> Also, if reason is not given, doesn't that technically mean it is not an existing variable? Or is it considered existing if it is an optional argument?

Good question! I don't know. The following statement avoids the problem by the way.
  - Set _signal_'s reason to _reason_ if it is given, and a new "AbortError" DOMException otherwise.
  

-- 
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#discussion_r733337275

Received on Thursday, 21 October 2021 05:48:05 UTC