From e18e1309e7a47fd391dd01a77009e8f4c1965824 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 18 Oct 2021 06:39:17 +0000 Subject: [PATCH 01/20] add abort reason to AbortSignal and Controller --- dom.bs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/dom.bs b/dom.bs index 81d03af1f..0ba6cee54 100644 --- a/dom.bs +++ b/dom.bs @@ -1729,7 +1729,7 @@ interface AbortController { [SameObject] readonly attribute AbortSignal signal; - undefined abort(); + undefined abort(optional any reason = null); }; @@ -1741,8 +1741,9 @@ interface AbortController {
controller . signal
Returns the {{AbortSignal}} object associated with this object. -
controller . abort() -
Invoking this method will set this object's {{AbortSignal}}'s [=AbortSignal/aborted flag=] and +
controller . abort(reason) +
Invoking this method will set this object's {{AbortSignal}}'s [=AbortSignal/aborted flag=], + store the reason in this object's {{AbortSignal}}'s [=AbortSignal/abort reason=], and signal to any observers that the associated activity is to be aborted. @@ -1762,8 +1763,10 @@ constructor steps are:

The signal getter steps are to return this's signal. -

The abort() method steps are to -signal abort on this's signal. +

The abort(reason) method steps are to +signal abort on this's signal, with +the provided reason. If a reason is not passed, create a new "{{AbortError!!exception}}" +{{DOMException}}.

Interface {{AbortSignal}}

@@ -1775,6 +1778,8 @@ interface AbortSignal : EventTarget { readonly attribute boolean aborted; + readonly attribute any reason; + attribute EventHandler onabort; }; @@ -1790,6 +1795,9 @@ interface AbortSignal : EventTarget {

An {{AbortSignal}} object has an associated aborted flag. It is unset unless specified otherwise. +

An {{AbortSignal}} object has an associated abort reason, which is an +argument given to {{AbortController}}'s {{AbortController/abort()}}, or undefined. +

An {{AbortSignal}} object has associated abort algorithms, which is a set of algorithms which are to be executed when its [=AbortSignal/aborted flag=] is set. Unless specified otherwise, its value is the empty set. @@ -1826,6 +1834,9 @@ service worker.

The aborted getter steps are to return true if this's [=AbortSignal/aborted flag=] is set; otherwise false. +

The reason getter steps are to return this's +abort reason. +

The onabort attribute is an event handler IDL attribute for the onabort event handler, whose event handler event type is From 9fd15838902e6aaee0e3caefe8eb32a37a0e1321 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Tue, 19 Oct 2021 09:56:44 +0000 Subject: [PATCH 02/20] address comments --- dom.bs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/dom.bs b/dom.bs index 0ba6cee54..d077ec385 100644 --- a/dom.bs +++ b/dom.bs @@ -1729,7 +1729,7 @@ interface AbortController { [SameObject] readonly attribute AbortSignal signal; - undefined abort(optional any reason = null); + undefined abort(optional any reason); }; @@ -1743,7 +1743,7 @@ interface AbortController {

controller . abort(reason)
Invoking this method will set this object's {{AbortSignal}}'s [=AbortSignal/aborted flag=], - store the reason in this object's {{AbortSignal}}'s [=AbortSignal/abort reason=], and + store the reason in this object's {{AbortSignal}}'s [=AbortSignal/abort reason=], and signal to any observers that the associated activity is to be aborted. @@ -1763,11 +1763,17 @@ constructor steps are:

The signal getter steps are to return this's signal. -

The abort(reason) method steps are to -signal abort on this's signal, with -the provided reason. If a reason is not passed, create a new "{{AbortError!!exception}}" -{{DOMException}}. +

The abort(reason) method steps are: +

    +
  1. If reason is undefined, let reason be a new "{{AbortError!!exception}}" + {{DOMException}}. + +

  2. Set this's signal's abort reason + to reason. + +

  3. Signal abort on this's signal. +

Interface {{AbortSignal}}

@@ -1787,6 +1793,10 @@ interface AbortSignal : EventTarget {
AbortSignal . abort()
Returns an {{AbortSignal}} instance whose aborted flag is set. +
signal . reason +
Returns the abort reason for an {{AbortSignal}} if it has been + set; otherwise returns an "{{AbortError!!exception}}" {{DOMException}}. +
signal . aborted
Returns true if this {{AbortSignal}}'s {{AbortController}} has signaled to abort; otherwise false. @@ -1795,8 +1805,8 @@ interface AbortSignal : EventTarget {

An {{AbortSignal}} object has an associated aborted flag. It is unset unless specified otherwise. -

An {{AbortSignal}} object has an associated abort reason, which is an -argument given to {{AbortController}}'s {{AbortController/abort()}}, or undefined. +

An {{AbortSignal}} object has an associated abort reason, which is a +JavaScript value given to {{AbortController}}'s {{AbortController/abort()}}, or undefined.

An {{AbortSignal}} object has associated abort algorithms, which is a set of algorithms which are to be executed when its [=AbortSignal/aborted flag=] is From 74a1f2f2910b4b1f79ec43ee288fa0d7c72c041b Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Wed, 20 Oct 2021 06:46:39 +0000 Subject: [PATCH 03/20] pass reason to signal abort --- dom.bs | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/dom.bs b/dom.bs index d077ec385..dcf812747 100644 --- a/dom.bs +++ b/dom.bs @@ -1763,17 +1763,9 @@ constructor steps are:

The signal getter steps are to return this's signal. -

The abort(reason) method steps are: - -

    -
  1. If reason is undefined, let reason be a new "{{AbortError!!exception}}" - {{DOMException}}. - -

  2. Set this's signal's abort reason - to reason. - -

  3. Signal abort on this's signal. -

+

The abort(reason) method steps are to +signal abort on this's signal with +reason if it is given.

Interface {{AbortSignal}}

@@ -1857,13 +1849,18 @@ service worker. them. For instance, if the operation has already completed.

To signal abort, given an {{AbortSignal}} object -signal, run these steps: +signal and an optional abort reason, run these steps:

  1. If signal's [=AbortSignal/aborted flag=] is set, then return.

  2. Set signal's [=AbortSignal/aborted flag=]. +

  3. If reason is undefined or not given, then let reason be + a new "{{AbortError!!exception}}" {{DOMException}}. + +

  4. Set signal's [=AbortSignal/abort reason=] to reason. +

  5. For each algorithm in signal's [=AbortSignal/abort algorithms=]: run algorithm. @@ -1880,14 +1877,16 @@ these steps:

  6. If followingSignal's [=AbortSignal/aborted flag=] is set, then return.

  7. If parentSignal's [=AbortSignal/aborted flag=] is set, then - signal abort on followingSignal. + signal abort on followingSignal with parentSignal's + [=AbortSignal/abort reason=].

  8. Otherwise, add the following abort steps to parentSignal:

      -
    1. Signal abort on followingSignal. +

    2. Signal abort on followingSignal with + parentSignal's [=AbortSignal/abort reason=].

From 6a10478bf776287a9779f1d2fa2a5d939e61a539 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Thu, 21 Oct 2021 03:01:40 +0000 Subject: [PATCH 04/20] add reason to static abort & fix description --- dom.bs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/dom.bs b/dom.bs index dcf812747..73d775827 100644 --- a/dom.bs +++ b/dom.bs @@ -1772,7 +1772,7 @@ constructor steps are:
 [Exposed=(Window,Worker)]
 interface AbortSignal : EventTarget {
-  [NewObject] static AbortSignal abort();
+  [NewObject] static AbortSignal abort(optional any reason);
 
   readonly attribute boolean aborted;
 
@@ -1782,12 +1782,14 @@ interface AbortSignal : EventTarget {
 };
-
AbortSignal . abort() -
Returns an {{AbortSignal}} instance whose aborted flag is set. +
AbortSignal . abort(reason) +
Returns an {{AbortSignal}} instance whose aborted flag is set, and + abort reason is set to reason if provided, otherwise to + "{{AbortError!!exception}}" {{DOMException}}.
signal . reason
Returns the abort reason for an {{AbortSignal}} if it has been - set; otherwise returns an "{{AbortError!!exception}}" {{DOMException}}. + set; by default this will be an "{{AbortError!!exception}}" {{DOMException}}.
signal . aborted
Returns true if this {{AbortSignal}}'s {{AbortController}} has signaled to abort; otherwise @@ -1823,13 +1825,18 @@ requirements to react in a reasonable way to {{AbortController/abort()}}. For ex [=AbortSignal/aborted flag=] might need to be propagated to a cross-thread environment, such as a service worker. -

The static abort() method steps are: +

The static abort(reason) method steps are:

  1. Let signal be a new {{AbortSignal}} object.

  2. Set signal's [=AbortSignal/aborted flag=]. +

  3. If reason is undefined or not given, then let reason be a new + "{{AbortError!!exception}}" {{DOMException}}. + +

  4. Set signal's [=AbortSignal/abort reason=] to reason. +

  5. Return signal.
From e2d579252a3fa0527681969a7262dbba6dfd5bbf Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Thu, 21 Oct 2021 04:25:02 +0000 Subject: [PATCH 05/20] make small fixes --- dom.bs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dom.bs b/dom.bs index 73d775827..6328005ed 100644 --- a/dom.bs +++ b/dom.bs @@ -1743,7 +1743,7 @@ interface AbortController {
controller . abort(reason)
Invoking this method will set this object's {{AbortSignal}}'s [=AbortSignal/aborted flag=], - store the reason in this object's {{AbortSignal}}'s [=AbortSignal/abort reason=], and + store reason in this object's {{AbortSignal}}'s [=AbortSignal/abort reason=], and signal to any observers that the associated activity is to be aborted.
@@ -1784,12 +1784,12 @@ interface AbortSignal : EventTarget {
AbortSignal . abort(reason)
Returns an {{AbortSignal}} instance whose aborted flag is set, and - abort reason is set to reason if provided, otherwise to + abort reason is set to reason if provided, otherwise to an "{{AbortError!!exception}}" {{DOMException}}.
signal . reason -
Returns the abort reason for an {{AbortSignal}} if it has been - set; by default this will be an "{{AbortError!!exception}}" {{DOMException}}. +
Returns the abort reason for an {{AbortSignal}}; by default this will + be an "{{AbortError!!exception}}" {{DOMException}}.
signal . aborted
Returns true if this {{AbortSignal}}'s {{AbortController}} has signaled to abort; otherwise @@ -1856,7 +1856,7 @@ service worker. them. For instance, if the operation has already completed.

To signal abort, given an {{AbortSignal}} object -signal and an optional abort reason, run these steps: +signal and an optional reason, run these steps:

  1. If signal's [=AbortSignal/aborted flag=] is set, then return. From 8fbd339c0c865a87d732c9268bdff2f94aa4e8a5 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Thu, 21 Oct 2021 06:37:44 +0000 Subject: [PATCH 06/20] remove undefined & combine reason assignment steps --- dom.bs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dom.bs b/dom.bs index 6328005ed..b7bc3d8ae 100644 --- a/dom.bs +++ b/dom.bs @@ -1832,10 +1832,8 @@ service worker.

  2. Set signal's [=AbortSignal/aborted flag=]. -

  3. If reason is undefined or not given, then let reason be a new - "{{AbortError!!exception}}" {{DOMException}}. - -

  4. Set signal's [=AbortSignal/abort reason=] to reason. +

  5. Set signal's [=AbortSignal/abort reason=] to reason if it is given, + and a new "{{AbortError!!exception}}" {{DOMException}} otherwise.

  6. Return signal.
@@ -1863,10 +1861,8 @@ them. For instance, if the operation has already completed.
  • Set signal's [=AbortSignal/aborted flag=]. -

  • If reason is undefined or not given, then let reason be - a new "{{AbortError!!exception}}" {{DOMException}}. - -

  • Set signal's [=AbortSignal/abort reason=] to reason. +

  • Set signal's [=AbortSignal/abort reason=] to reason if it is given, + and a new "{{AbortError!!exception}}" {{DOMException}} otherwise.

  • For each algorithm in signal's [=AbortSignal/abort algorithms=]: run algorithm. From a213031a0bb1d0d083805a102b9e7d5d91f8ff2c Mon Sep 17 00:00:00 2001 From: Nidhi Jaju <41948741+nidhijaju@users.noreply.github.com> Date: Thu, 21 Oct 2021 17:12:06 +0900 Subject: [PATCH 07/20] Apply suggestions from code review Co-authored-by: Anne van Kesteren --- dom.bs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dom.bs b/dom.bs index b7bc3d8ae..7f7958d55 100644 --- a/dom.bs +++ b/dom.bs @@ -1800,7 +1800,7 @@ interface AbortSignal : EventTarget { unset unless specified otherwise.

    An {{AbortSignal}} object has an associated abort reason, which is a -JavaScript value given to {{AbortController}}'s {{AbortController/abort()}}, or undefined. +JavaScript value.

    An {{AbortSignal}} object has associated abort algorithms, which is a set of algorithms which are to be executed when its [=AbortSignal/aborted flag=] is @@ -1832,8 +1832,8 @@ service worker.

  • Set signal's [=AbortSignal/aborted flag=]. -

  • Set signal's [=AbortSignal/abort reason=] to reason if it is given, - and a new "{{AbortError!!exception}}" {{DOMException}} otherwise. +

  • Set signal's [=AbortSignal/abort reason=] to reason if it is given; + otherwise to a new "{{AbortError!!exception}}" {{DOMException}}.

  • Return signal. @@ -1861,8 +1861,8 @@ them. For instance, if the operation has already completed.
  • Set signal's [=AbortSignal/aborted flag=]. -

  • Set signal's [=AbortSignal/abort reason=] to reason if it is given, - and a new "{{AbortError!!exception}}" {{DOMException}} otherwise. +

  • Set signal's [=AbortSignal/abort reason=] to reason if it is given; + otherwise to a new "{{AbortError!!exception}}" {{DOMException}}.

  • For each algorithm in signal's [=AbortSignal/abort algorithms=]: run algorithm. From 0eaaf5192bbca42bfd9308135f55aa248f1c12f0 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Thu, 21 Oct 2021 08:16:36 +0000 Subject: [PATCH 08/20] add --- dom.bs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dom.bs b/dom.bs index 7f7958d55..93c4022fc 100644 --- a/dom.bs +++ b/dom.bs @@ -1763,8 +1763,8 @@ constructor steps are:

    The signal getter steps are to return this's signal. -

    The abort(reason) method steps are to -signal abort on this's signal with +

    The abort(reason) method steps are +to signal abort on this's signal with reason if it is given.

    Interface {{AbortSignal}}

    @@ -1825,7 +1825,8 @@ requirements to react in a reasonable way to {{AbortController/abort()}}. For ex [=AbortSignal/aborted flag=] might need to be propagated to a cross-thread environment, such as a service worker. -

    The static abort(reason) method steps are: +

    The static abort(reason) method steps +are:

    1. Let signal be a new {{AbortSignal}} object. From 03f41be88b2d2760b3964b26d8d0debc8a72a003 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Tue, 26 Oct 2021 04:59:53 +0000 Subject: [PATCH 09/20] address comments --- dom.bs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dom.bs b/dom.bs index 93c4022fc..48fdd65d6 100644 --- a/dom.bs +++ b/dom.bs @@ -1788,8 +1788,7 @@ interface AbortSignal : EventTarget { "{{AbortError!!exception}}" {{DOMException}}.

      signal . reason -
      Returns the abort reason for an {{AbortSignal}}; by default this will - be an "{{AbortError!!exception}}" {{DOMException}}. +
      Returns this {{AbortSignal}}'s abort reason.
      signal . aborted
      Returns true if this {{AbortSignal}}'s {{AbortController}} has signaled to abort; otherwise @@ -1800,7 +1799,7 @@ interface AbortSignal : EventTarget { unset unless specified otherwise.

      An {{AbortSignal}} object has an associated abort reason, which is a -JavaScript value. +JavaScript value. It is undefined unless specified otherwise.

      An {{AbortSignal}} object has associated abort algorithms, which is a set of algorithms which are to be executed when its [=AbortSignal/aborted flag=] is From a10677ae850c07d78d3091054088ed5ab2e23da7 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Tue, 26 Oct 2021 07:21:11 +0000 Subject: [PATCH 10/20] add name to acknowledgements --- dom.bs | 1 + 1 file changed, 1 insertion(+) diff --git a/dom.bs b/dom.bs index 48fdd65d6..03cd734e4 100644 --- a/dom.bs +++ b/dom.bs @@ -10097,6 +10097,7 @@ Mike Champion, Mike Taylor, Mike West, Nicolás Peña Moreno, +Nidhi Jaju, Ojan Vafai, Oliver Nightingale, Olli Pettay, From 239e09448c714af37df81d201115b02236383b98 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju <41948741+nidhijaju@users.noreply.github.com> Date: Tue, 26 Oct 2021 18:22:12 +0900 Subject: [PATCH 11/20] remove empty line in AbortSignal interface Co-authored-by: Anne van Kesteren --- dom.bs | 1 - 1 file changed, 1 deletion(-) diff --git a/dom.bs b/dom.bs index 03cd734e4..adcb015d1 100644 --- a/dom.bs +++ b/dom.bs @@ -1775,7 +1775,6 @@ interface AbortSignal : EventTarget { [NewObject] static AbortSignal abort(optional any reason); readonly attribute boolean aborted; - readonly attribute any reason; attribute EventHandler onabort; From c6297b8f0699119907050592b6bca0b4bcb91603 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Tue, 26 Oct 2021 09:25:26 +0000 Subject: [PATCH 12/20] move signal.reason below aborted --- dom.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dom.bs b/dom.bs index adcb015d1..fcfc802f0 100644 --- a/dom.bs +++ b/dom.bs @@ -1786,12 +1786,12 @@ interface AbortSignal : EventTarget { abort reason is set to reason if provided, otherwise to an "{{AbortError!!exception}}" {{DOMException}}. -

      signal . reason -
      Returns this {{AbortSignal}}'s abort reason. -
      signal . aborted
      Returns true if this {{AbortSignal}}'s {{AbortController}} has signaled to abort; otherwise false. + +
      signal . reason +
      Returns this {{AbortSignal}}'s abort reason.
  • An {{AbortSignal}} object has an associated aborted flag. It is From fa2dd312ec87f1ab17cde853dd7085a1a578e918 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Thu, 28 Oct 2021 07:34:57 +0000 Subject: [PATCH 13/20] add abort reason assertion to signal abort --- dom.bs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dom.bs b/dom.bs index fcfc802f0..28ebb2bde 100644 --- a/dom.bs +++ b/dom.bs @@ -1863,6 +1863,8 @@ them. For instance, if the operation has already completed.

  • Set signal's [=AbortSignal/abort reason=] to reason if it is given; otherwise to a new "{{AbortError!!exception}}" {{DOMException}}. +

  • Assert: signal's [=AbortSignal/abort reason=] is not undefined. +

  • For each algorithm in signal's [=AbortSignal/abort algorithms=]: run algorithm. From 98dcce79ba4404d3d08ddf5667e0061da16476e1 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Thu, 28 Oct 2021 10:51:48 +0000 Subject: [PATCH 14/20] remove aborted flag --- dom.bs | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/dom.bs b/dom.bs index 28ebb2bde..abb995a14 100644 --- a/dom.bs +++ b/dom.bs @@ -1114,8 +1114,8 @@ participate in a tree structure.

    service worker events, then report a warning to the console that this might not give the expected results. [[!SERVICE-WORKERS]] -
  • If signal is not null and its [=AbortSignal/aborted flag=] is - set, then return. +

  • If signal is not null and its [=AbortSignal/abort reason=] is + not undefined, then return.

  • If listener's callback is null, then return. @@ -1742,9 +1742,9 @@ interface AbortController {

    Returns the {{AbortSignal}} object associated with this object.
    controller . abort(reason) -
    Invoking this method will set this object's {{AbortSignal}}'s [=AbortSignal/aborted flag=], - store reason in this object's {{AbortSignal}}'s [=AbortSignal/abort reason=], and - signal to any observers that the associated activity is to be aborted. +
    Invoking this method will store reason in this object's {{AbortSignal}}'s + [=AbortSignal/abort reason=], and signal to any observers that the associated activity is to be + aborted.

    An {{AbortController}} object has an associated signal (an @@ -1782,9 +1782,8 @@ interface AbortSignal : EventTarget {

    AbortSignal . abort(reason) -
    Returns an {{AbortSignal}} instance whose aborted flag is set, and - abort reason is set to reason if provided, otherwise to an - "{{AbortError!!exception}}" {{DOMException}}. +
    Returns an {{AbortSignal}} instance whose abort reason is set to + reason if provided, otherwise to an "{{AbortError!!exception}}" {{DOMException}}.
    signal . aborted
    Returns true if this {{AbortSignal}}'s {{AbortController}} has signaled to abort; otherwise @@ -1794,21 +1793,18 @@ interface AbortSignal : EventTarget {
    Returns this {{AbortSignal}}'s abort reason.
    -

    An {{AbortSignal}} object has an associated aborted flag. It is -unset unless specified otherwise. -

    An {{AbortSignal}} object has an associated abort reason, which is a JavaScript value. It is undefined unless specified otherwise.

    An {{AbortSignal}} object has associated abort algorithms, which is a -set of algorithms which are to be executed when its [=AbortSignal/aborted flag=] is -set. Unless specified otherwise, its value is the empty set. +set of algorithms which are to be executed when its [=AbortSignal/abort reason=] is +not undefined. Unless specified otherwise, its value is the empty set.

    To add an algorithm algorithm to an {{AbortSignal}} object signal, run these steps:

      -
    1. If signal's aborted flag is set, then return. +

    2. If signal's abort reason is not undefined, then return.

    3. Append algorithm to signal's abort algorithms. @@ -1820,7 +1816,7 @@ object signal, run these steps:

      The [=AbortSignal/abort algorithms=] enable APIs with complex requirements to react in a reasonable way to {{AbortController/abort()}}. For example, a given API's -[=AbortSignal/aborted flag=] might need to be propagated to a cross-thread environment, such as a +[=AbortSignal/abort reason=] might need to be propagated to a cross-thread environment, such as a service worker.

      The static abort(reason) method steps @@ -1829,8 +1825,6 @@ are:

      1. Let signal be a new {{AbortSignal}} object. -

      2. Set signal's [=AbortSignal/aborted flag=]. -

      3. Set signal's [=AbortSignal/abort reason=] to reason if it is given; otherwise to a new "{{AbortError!!exception}}" {{DOMException}}. @@ -1838,7 +1832,7 @@ are:

      The aborted getter steps are to return true if this's -[=AbortSignal/aborted flag=] is set; otherwise false. +[=AbortSignal/abort reason=] is not undefined; otherwise false.

      The reason getter steps are to return this's abort reason. @@ -1856,9 +1850,7 @@ them. For instance, if the operation has already completed. signal and an optional reason, run these steps:

        -
      1. If signal's [=AbortSignal/aborted flag=] is set, then return. - -

      2. Set signal's [=AbortSignal/aborted flag=]. +

      3. If signal's [=AbortSignal/abort reason=] is not undefined, then return.

      4. Set signal's [=AbortSignal/abort reason=] to reason if it is given; otherwise to a new "{{AbortError!!exception}}" {{DOMException}}. @@ -1878,9 +1870,9 @@ them. For instance, if the operation has already completed. these steps:

          -
        1. If followingSignal's [=AbortSignal/aborted flag=] is set, then return. +

        2. If followingSignal's [=AbortSignal/abort reason=] is not undefined, then return. -

        3. If parentSignal's [=AbortSignal/aborted flag=] is set, then +

        4. If parentSignal's [=AbortSignal/abort reason=] is not undefined, then signal abort on followingSignal with parentSignal's [=AbortSignal/abort reason=]. @@ -1905,7 +1897,7 @@ the following:

        5. Accept {{AbortSignal}} objects through a signal dictionary member.
        6. Convey that the operation got aborted by rejecting the promise with an "{{AbortError!!exception}}" {{DOMException}}. -
        7. Reject immediately if the {{AbortSignal}}'s [=AbortSignal/aborted flag=] is already set, +
        8. Reject immediately if the {{AbortSignal}}'s [=AbortSignal/abort reason=] is already not undefined, otherwise:
        9. Use the [=AbortSignal/abort algorithms=] mechanism to observe changes to the {{AbortSignal}} object and do so in a manner that does not lead to clashes with other observers. @@ -1922,8 +1914,8 @@ the following:

          If |options|' signal member is present, then:

            -
          1. If |options|' signal's [=AbortSignal/aborted flag=] is set, then [=reject=] - |p| with an "{{AbortError!!exception}}" {{DOMException}} and return |p|. +

          2. If |options|' signal's [=AbortSignal/abort reason=] is not undefined, then + [=reject=] |p| with an "{{AbortError!!exception}}" {{DOMException}} and return |p|.

          3. [=AbortSignal/Add|Add the following abort steps=] to |options|' signal: From a321593b581e89ab2344400f0e6464a0eb6a4aae Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Thu, 28 Oct 2021 11:03:53 +0000 Subject: [PATCH 15/20] remove assert --- dom.bs | 2 -- 1 file changed, 2 deletions(-) diff --git a/dom.bs b/dom.bs index abb995a14..82da8042c 100644 --- a/dom.bs +++ b/dom.bs @@ -1855,8 +1855,6 @@ them. For instance, if the operation has already completed.

          4. Set signal's [=AbortSignal/abort reason=] to reason if it is given; otherwise to a new "{{AbortError!!exception}}" {{DOMException}}. -

          5. Assert: signal's [=AbortSignal/abort reason=] is not undefined. -

          6. For each algorithm in signal's [=AbortSignal/abort algorithms=]: run algorithm. From e469279c0db0ee3760930d4fc00b73a011df466c Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Fri, 29 Oct 2021 04:54:33 +0000 Subject: [PATCH 16/20] add aborted predicate --- dom.bs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dom.bs b/dom.bs index 82da8042c..7f3e3676f 100644 --- a/dom.bs +++ b/dom.bs @@ -1796,6 +1796,9 @@ interface AbortSignal : EventTarget {

            An {{AbortSignal}} object has an associated abort reason, which is a JavaScript value. It is undefined unless specified otherwise. +

            An {{AbortSignal}} is aborted when its +[=AbortSignal/abort reason=] is not undefined. +

            An {{AbortSignal}} object has associated abort algorithms, which is a set of algorithms which are to be executed when its [=AbortSignal/abort reason=] is not undefined. Unless specified otherwise, its value is the empty set. @@ -1804,7 +1807,7 @@ not undefined. Unless specified otherwise, its value is the empty set. object signal, run these steps:

              -
            1. If signal's abort reason is not undefined, then return. +

            2. If signal is [=AbortSignal/aborted=], then return.

            3. Append algorithm to signal's abort algorithms. @@ -1831,8 +1834,8 @@ are:

            4. Return signal.
            -

            The aborted getter steps are to return true if this's -[=AbortSignal/abort reason=] is not undefined; otherwise false. +

            The aborted getter steps are to return true if this +is [=AbortSignal/aborted=]; otherwise false.

            The reason getter steps are to return this's abort reason. @@ -1850,7 +1853,7 @@ them. For instance, if the operation has already completed. signal and an optional reason, run these steps:

              -
            1. If signal's [=AbortSignal/abort reason=] is not undefined, then return. +

            2. If signal is [=AbortSignal/aborted=], then return.

            3. Set signal's [=AbortSignal/abort reason=] to reason if it is given; otherwise to a new "{{AbortError!!exception}}" {{DOMException}}. @@ -1868,9 +1871,9 @@ them. For instance, if the operation has already completed. these steps:

                -
              1. If followingSignal's [=AbortSignal/abort reason=] is not undefined, then return. +

              2. If followingSignal is [=AbortSignal/aborted=], then return. -

              3. If parentSignal's [=AbortSignal/abort reason=] is not undefined, then +

              4. If parentSignal is [=AbortSignal/aborted=], then signal abort on followingSignal with parentSignal's [=AbortSignal/abort reason=]. @@ -1912,8 +1915,8 @@ the following:

                If |options|' signal member is present, then:

                  -
                1. If |options|' signal's [=AbortSignal/abort reason=] is not undefined, then - [=reject=] |p| with an "{{AbortError!!exception}}" {{DOMException}} and return |p|. +

                2. If |options|' signal is [=AbortSignal/aborted=], then [=reject=] |p| with + an "{{AbortError!!exception}}" {{DOMException}} and return |p|.

                3. [=AbortSignal/Add|Add the following abort steps=] to |options|' signal: From c102cd8b2cd3101e0f57bb4aa38b044a5cc196aa Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Fri, 29 Oct 2021 05:03:05 +0000 Subject: [PATCH 17/20] use predicate in more places --- dom.bs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dom.bs b/dom.bs index 7f3e3676f..ebe2704db 100644 --- a/dom.bs +++ b/dom.bs @@ -1114,8 +1114,8 @@ participate in a tree structure.

                  service worker events, then report a warning to the console that this might not give the expected results. [[!SERVICE-WORKERS]] -
                4. If signal is not null and its [=AbortSignal/abort reason=] is - not undefined, then return. +

                5. If signal is not null and is [=AbortSignal/aborted=], then + return.

                6. If listener's callback is null, then return. @@ -1800,8 +1800,8 @@ JavaScript value. It is undefined unless specified otherwise. [=AbortSignal/abort reason=] is not undefined.

                  An {{AbortSignal}} object has associated abort algorithms, which is a -set of algorithms which are to be executed when its [=AbortSignal/abort reason=] is -not undefined. Unless specified otherwise, its value is the empty set. +set of algorithms which are to be executed when it is [=AbortSignal/aborted=]. Unless +specified otherwise, its value is the empty set.

                  To add an algorithm algorithm to an {{AbortSignal}} object signal, run these steps: @@ -1898,8 +1898,7 @@ the following:

                7. Accept {{AbortSignal}} objects through a signal dictionary member.
                8. Convey that the operation got aborted by rejecting the promise with an "{{AbortError!!exception}}" {{DOMException}}. -
                9. Reject immediately if the {{AbortSignal}}'s [=AbortSignal/abort reason=] is already not undefined, - otherwise: +
                10. Reject immediately if the {{AbortSignal}} is already [=AbortSignal/aborted=], otherwise:
                11. Use the [=AbortSignal/abort algorithms=] mechanism to observe changes to the {{AbortSignal}} object and do so in a manner that does not lead to clashes with other observers. From dbbfeb6d9ccaa25f21cb2d81f71ee3e1e059d48f Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Fri, 29 Oct 2021 05:09:32 +0000 Subject: [PATCH 18/20] fix reason var --- dom.bs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dom.bs b/dom.bs index ebe2704db..bbfa98054 100644 --- a/dom.bs +++ b/dom.bs @@ -1741,8 +1741,9 @@ interface AbortController {
                  controller . signal
                  Returns the {{AbortSignal}} object associated with this object. -
                  controller . abort(reason) -
                  Invoking this method will store reason in this object's {{AbortSignal}}'s +
                  controller . abort + (reason) +
                  Invoking this method will store reason in this object's {{AbortSignal}}'s [=AbortSignal/abort reason=], and signal to any observers that the associated activity is to be aborted. @@ -1781,7 +1782,7 @@ interface AbortSignal : EventTarget { };
                  -
                  AbortSignal . abort(reason) +
                  AbortSignal . abort(reason)
                  Returns an {{AbortSignal}} instance whose abort reason is set to reason if provided, otherwise to an "{{AbortError!!exception}}" {{DOMException}}. From 330c5d7f86e7077a62b81b1a5823ffd0816fbbf6 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 29 Oct 2021 10:20:45 +0200 Subject: [PATCH 19/20] also update the "how to use" section --- dom.bs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/dom.bs b/dom.bs index bbfa98054..efe0910fd 100644 --- a/dom.bs +++ b/dom.bs @@ -1797,7 +1797,7 @@ interface AbortSignal : EventTarget {

                  An {{AbortSignal}} object has an associated abort reason, which is a JavaScript value. It is undefined unless specified otherwise. -

                  An {{AbortSignal}} is aborted when its +

                  An {{AbortSignal}} object is aborted when its [=AbortSignal/abort reason=] is not undefined.

                  An {{AbortSignal}} object has associated abort algorithms, which is a @@ -1897,34 +1897,36 @@ the following:

                  • Accept {{AbortSignal}} objects through a signal dictionary member. -
                  • Convey that the operation got aborted by rejecting the promise with an - "{{AbortError!!exception}}" {{DOMException}}. +
                  • Convey that the operation got aborted by rejecting the promise with {{AbortSignal}} object's + [=AbortSignal/abort reason=].
                  • Reject immediately if the {{AbortSignal}} is already [=AbortSignal/aborted=], otherwise:
                  • Use the [=AbortSignal/abort algorithms=] mechanism to observe changes to the {{AbortSignal}} object and do so in a manner that does not lead to clashes with other observers.
                  -

                  The steps for a promise-returning method doAmazingness(options) could be as - follows: +

                  The method steps for a promise-returning method doAmazingness(options) + could be as follows:

                  1. Let |p| be [=a new promise=].

                  2. -

                    If |options|' signal member is present, then: +

                    If |options|["signal"] member is present, then:

                      -
                    1. If |options|' signal is [=AbortSignal/aborted=], then [=reject=] |p| with - an "{{AbortError!!exception}}" {{DOMException}} and return |p|. +

                    2. Let |signal| be |options|["signal"]. + +

                    3. If |signal| is [=AbortSignal/aborted=], then [=reject=] |p| with |signal|'s + [=AbortSignal/abort reason=] and return |p|.

                    4. -

                      [=AbortSignal/Add|Add the following abort steps=] to |options|' signal: +

                      [=AbortSignal/Add|Add the following abort steps=] to |signal|:

                      1. Stop doing amazing things. -

                      2. [=Reject=] |p| with an "{{AbortError!!exception}}" {{DOMException}}. +

                      3. [=Reject=] |p| with |signal|'s [=AbortSignal/abort reason=].

                    From 723f5e829273170b54511ffa6bea01a95fe52193 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Sat, 30 Oct 2021 08:07:47 +0200 Subject: [PATCH 20/20] nits --- dom.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dom.bs b/dom.bs index efe0910fd..0063273e8 100644 --- a/dom.bs +++ b/dom.bs @@ -1114,8 +1114,8 @@ participate in a tree structure.

                    service worker events, then report a warning to the console that this might not give the expected results. [[!SERVICE-WORKERS]] -
                  3. If signal is not null and is [=AbortSignal/aborted=], then - return. +

                  4. If listener's signal is not null and is + [=AbortSignal/aborted=], then return.

                  5. If listener's callback is null, then return. @@ -1741,11 +1741,11 @@ interface AbortController {

                    controller . signal
                    Returns the {{AbortSignal}} object associated with this object. -
                    controller . abort - (reason) +
                    controller . abort(reason)
                    Invoking this method will store reason in this object's {{AbortSignal}}'s [=AbortSignal/abort reason=], and signal to any observers that the associated activity is to be - aborted. + aborted. If reason is undefined, then an "{{AbortError!!exception}}" {{DOMException}} + will be stored.

                  An {{AbortController}} object has an associated signal (an @@ -1784,7 +1784,7 @@ interface AbortSignal : EventTarget {

                  AbortSignal . abort(reason)
                  Returns an {{AbortSignal}} instance whose abort reason is set to - reason if provided, otherwise to an "{{AbortError!!exception}}" {{DOMException}}. + reason if not undefined; otherwise to an "{{AbortError!!exception}}" {{DOMException}}.
                  signal . aborted
                  Returns true if this {{AbortSignal}}'s {{AbortController}} has signaled to abort; otherwise