From a18ee76f7e60c75fc952e0fa04f37f5af47153e0 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Wed, 27 Oct 2021 03:24:08 +0000 Subject: [PATCH 01/28] add abort reason to abort fetch --- fetch.bs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/fetch.bs b/fetch.bs index 92c09c30b..6b2e888e7 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7428,12 +7428,16 @@ method steps are:
  • Let request be requestObject's request. +

  • If requestObject's signal is an {{AbortSignal}}, let + error be requestObject's signal's + abort reason, and undefined otherwise. +

  • If requestObject's signal's aborted flag is set, then:

      -
    1. Abort fetch with p, request, and null. +

    2. Abort fetch with p, request, null, and error.

    3. Return p.

    @@ -7461,7 +7465,8 @@ method steps are:
    1. Set locallyAborted to true. -

    2. Abort fetch with p, request, and responseObject. +

    3. Abort fetch with p, request, responseObject, and + error.

    4. Terminate the ongoing fetch with the aborted flag set.

    @@ -7479,8 +7484,8 @@ method steps are:
  • If locallyAborted is true, terminate these substeps.

  • If response's aborted flag is set, then abort fetch - with p, request, and responseObject, and terminate these - substeps. + with p, request, responseObject, and error, and + terminate these substeps.

  • If response is a network error, then reject p with a {{TypeError}} and terminate these substeps. @@ -7494,11 +7499,12 @@ method steps are:

  • Return p. -

    To abort fetch with a promise, request, and -responseObject, run these steps: +

    To abort fetch with a promise, request, +responseObject, and an optional error, run these steps:

      -
    1. Let error be an "AbortError" {{DOMException}}. +

    2. If error is not given, let error be an + "AbortError" {{DOMException}}.

    3. Reject promise with error. From 6e0fe405d12390ce414b83e033d05afed289b6aa Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Wed, 27 Oct 2021 05:02:07 +0000 Subject: [PATCH 02/28] add name to acknowledgments --- fetch.bs | 1 + 1 file changed, 1 insertion(+) diff --git a/fetch.bs b/fetch.bs index 6b2e888e7..1a277a6e0 100644 --- a/fetch.bs +++ b/fetch.bs @@ -8085,6 +8085,7 @@ Moritz Kneilmann, Ms2ger, Nico Schlömer, Nicolás Peña Moreno, +Nidhi Jaju, Nikhil Marathe, Nikki Bee, Nikunj Mehta, From 4a0642756d6d1f95b1b689d243390e47f6aadf6e Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Wed, 27 Oct 2021 08:24:55 +0000 Subject: [PATCH 03/28] remove if condition --- fetch.bs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fetch.bs b/fetch.bs index 1a277a6e0..8234669c8 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7428,9 +7428,8 @@ method steps are:

    4. Let request be requestObject's request. -

    5. If requestObject's signal is an {{AbortSignal}}, let - error be requestObject's signal's - abort reason, and undefined otherwise. +

    6. Let error be requestObject's signal's + abort reason.

    7. If requestObject's signal's aborted flag From eb499b48e68279f93d00e6793a655dda63bab5cb Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 1 Nov 2021 05:47:20 +0000 Subject: [PATCH 04/28] use aborted predicate --- fetch.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index 8234669c8..54bc418e1 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7432,8 +7432,8 @@ method steps are: abort reason.

    8. -

      If requestObject's signal's aborted flag - is set, then: +

      If requestObject's signal is aborted, + then:

      1. Abort fetch with p, request, null, and error. From c0833a5f90225396dabcf31eb63525ce7e9e82ac Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 1 Nov 2021 05:50:14 +0000 Subject: [PATCH 05/28] fix --- fetch.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index 54bc418e1..00d5bd37b 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7432,7 +7432,7 @@ method steps are: abort reason.

      2. -

        If requestObject's signal is aborted, +

        If requestObject's signal is aborted, then:

          From 4df5ef6d34ffd1f635d03282b5684e5b5bc3fd46 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 1 Nov 2021 05:47:20 +0000 Subject: [PATCH 06/28] use aborted predicate --- fetch.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index 832a41e27..f8e529820 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7735,7 +7735,7 @@ method steps are: abort reason.
        1. -

          If requestObject's signal is aborted, +

          If requestObject's signal is aborted, then:

            From 75d4badb449e5aa6e886e17ec4e61775b0b13623 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Thu, 4 Aug 2022 02:43:57 +0000 Subject: [PATCH 07/28] make changes --- fetch.bs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/fetch.bs b/fetch.bs index f8e529820..8c0f51fd9 100644 --- a/fetch.bs +++ b/fetch.bs @@ -231,6 +231,9 @@ lt="authentication entry">authentication entries (for HTTP authentication).
            report timing steps (default null)
            Null or an algorithm accepting a global object. + +
            cloned error (default "AbortError" {{DOMException}}) +
            "AbortError" {{DOMException}} or a Javascript value.

            To report timing for a @@ -254,8 +257,10 @@ given a fetch controller controller:

          To abort a fetch controller -controller, set controller's state to -"aborted". +controller with optional error, set controller's +state to "aborted", and set controller's +cloned error to error if given, and otherwise to +"AbortError" {{DOMException}}.

          To terminate a fetch controller controller, set controller's state to @@ -7797,16 +7802,21 @@ method steps are:

        2. Resolve p with responseObject.

        +
      3. Let serializedError be the result of [$StructuredSerialize$] + with error. If that threw an exception, then reject p with that exception. + +

      4. Set controller's cloned error to the result of + [$StructuredDeserialize$] with + serializedError and this's relevant Realm. If that threw an exception, + then reject p with that exception. +

      5. Return p.

      To abort fetch with a promise, request, -responseObject, and an optional error, run these steps: +responseObject, and an error, run these steps:

        -
      1. If error is not given, let error be an - "AbortError" {{DOMException}}. -

      2. Reject promise with error. From b6ddcaaf57a337b40ccec2a19731680fa09634d1 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Thu, 4 Aug 2022 02:56:16 +0000 Subject: [PATCH 08/28] fix syntax --- fetch.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index 8c0f51fd9..beac8fde5 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7740,7 +7740,7 @@ method steps are: abort reason.

      3. -

        If requestObject's signal is aborted, +

        If requestObject's signal is aborted, then:

          From ba73b86ce2ec7e0ccd5002eddc53939229fa5599 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Thu, 4 Aug 2022 08:22:41 +0000 Subject: [PATCH 09/28] address comments --- fetch.bs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fetch.bs b/fetch.bs index beac8fde5..3d56b93a7 100644 --- a/fetch.bs +++ b/fetch.bs @@ -232,8 +232,8 @@ lt="authentication entry">authentication entries (for HTTP authentication).
          report timing steps (default null)
          Null or an algorithm accepting a global object. -
          cloned error (default "AbortError" {{DOMException}}) -
          "AbortError" {{DOMException}} or a Javascript value. +
          cloned error (default null) +
          Null, "AbortError" {{DOMException}}, or a Javascript value.

          To report timing for a @@ -7802,13 +7802,12 @@ method steps are:

        1. Resolve p with responseObject.

        -
      4. Let serializedError be the result of [$StructuredSerialize$] +

      5. Let serializedError be the result of calling [$StructuredSerialize$] with error. If that threw an exception, then reject p with that exception.

      6. Set controller's cloned error to the result of - [$StructuredDeserialize$] with - serializedError and this's relevant Realm. If that threw an exception, - then reject p with that exception. + calling [$StructuredDeserialize$] with serializedError and this's + relevant Realm. If that threw an exception, then reject p with that exception.

      7. Return p.

      From ddd1628f81d53333758d957aee6f38ca3b5eac6e Mon Sep 17 00:00:00 2001 From: Nidhi Jaju <41948741+nidhijaju@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:16:26 +0900 Subject: [PATCH 10/28] Apply suggestions from code review Co-authored-by: Domenic Denicola --- fetch.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index 3d56b93a7..354051449 100644 --- a/fetch.bs +++ b/fetch.bs @@ -233,7 +233,7 @@ lt="authentication entry">authentication entries (for HTTP authentication).
      Null or an algorithm accepting a global object.
      cloned error (default null) -
      Null, "AbortError" {{DOMException}}, or a Javascript value. +
      Null, an "{{AbortError}}" {{DOMException}}, or a JavaScript value.

      To report timing for a @@ -260,7 +260,7 @@ given a fetch controller controller: controller with optional error, set controller's state to "aborted", and set controller's cloned error to error if given, and otherwise to -"AbortError" {{DOMException}}. +an "{{AbortError}}" {{DOMException}}.

      To terminate a fetch controller controller, set controller's state to From 14dac0d1df8673bb885143f538512c6439fe3277 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 15 Aug 2022 02:37:11 +0000 Subject: [PATCH 11/28] incorporate review comments --- fetch.bs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fetch.bs b/fetch.bs index 6b85fb2a3..4eb1f584a 100644 --- a/fetch.bs +++ b/fetch.bs @@ -232,8 +232,8 @@ lt="authentication entry">authentication entries (for HTTP authentication).

      report timing steps (default null)
      Null or an algorithm accepting a global object. -
      cloned error (default null) -
      Null, an "{{AbortError}}" {{DOMException}}, or a JavaScript value. +
      serialized abort reason (default null) +
      Null or a serialization from [$StructuredSerialize$].

      To report timing for a @@ -259,8 +259,8 @@ given a fetch controller controller:

      To abort a fetch controller controller with optional error, set controller's state to "aborted", and set controller's -cloned error to error if given, and otherwise to -an "{{AbortError}}" {{DOMException}}. +serialized abort reason to error if given, and otherwise to +an "AbortError" {{DOMException}}.

      To terminate a fetch controller controller, set controller's state to @@ -7806,12 +7806,14 @@ method steps are:

    9. Resolve p with responseObject.

    +
  • If error is undefined, let error be an "{{AbortError}}" {{DOMException}}. +

  • Let serializedError be the result of calling [$StructuredSerialize$] - with error. If that threw an exception, then reject p with that exception. + with error. If that threw an exception, let serializedError be the result of + calling [$StructuredSerialize$] with "{{AbortError}}" {{DOMException}}. -

  • Set controller's cloned error to the result of - calling [$StructuredDeserialize$] with serializedError and this's - relevant Realm. If that threw an exception, then reject p with that exception. +

  • Set controller's serialized abort reason to + serializedError.

  • Return p. From 8194bf613df9b38c7d45147b6055b3dd8c133dfa Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 15 Aug 2022 08:22:24 +0000 Subject: [PATCH 12/28] update abort controller --- fetch.bs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/fetch.bs b/fetch.bs index 4eb1f584a..c8d63d44d 100644 --- a/fetch.bs +++ b/fetch.bs @@ -257,10 +257,20 @@ given a fetch controller controller:

    To abort a fetch controller -controller with optional error, set controller's -state to "aborted", and set controller's -serialized abort reason to error if given, and otherwise to -an "AbortError" {{DOMException}}. +controller with optional error: + +

      +
    1. Set controller's state to "aborted". + +

    2. Let error be an "{{AbortError}}" {{DOMException}}, if it is not given. + +

    3. Let serializedError be the result of calling [$StructuredSerialize$] with + error. If that threw and exception, let serializedError be the result of calling + [$StructuredSerialize$] with "{{AbortError}}" {{DOMException}}. + +

    4. Set controller's serialized abort reason to + serializedError. +

    To terminate a fetch controller controller, set controller's state to @@ -7782,7 +7792,7 @@ method steps are: error.

  • If controller is not null, then abort - controller. + controller with error.

  • From f660a6eea40c2f3abf7db86f2bab77402e611517 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 15 Aug 2022 08:50:28 +0000 Subject: [PATCH 13/28] update fetch() --- fetch.bs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fetch.bs b/fetch.bs index c8d63d44d..b1fecbb38 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7750,15 +7750,13 @@ method steps are:
  • Let request be requestObject's request. -

  • Let error be requestObject's signal's - abort reason. -

  • If requestObject's signal is aborted, then:

      -
    1. Abort fetch with p, request, null, and error. +

    2. Abort fetch with p, request, null, and requestObject's + signal's abort reason.

    3. Return p.

    @@ -7789,10 +7787,11 @@ method steps are:
  • Set locallyAborted to true.

  • Abort fetch with p, request, responseObject, and - error. + requestObject's signal's abort reason.

  • If controller is not null, then abort - controller with error. + controller with requestObject's signal's + abort reason.

  • @@ -7816,7 +7815,9 @@ method steps are:
  • Resolve p with responseObject. -

  • If error is undefined, let error be an "{{AbortError}}" {{DOMException}}. +

  • Let error be requestObject's signal's + abort reason if it not undefined. Otherwise, let error be an + "{{AbortError}}" {{DOMException}}.

  • Let serializedError be the result of calling [$StructuredSerialize$] with error. If that threw an exception, let serializedError be the result of From 2255611013a3820836da56781df43d2ade41a89a Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 15 Aug 2022 10:14:02 +0000 Subject: [PATCH 14/28] move serialization to abort fetch --- fetch.bs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/fetch.bs b/fetch.bs index b1fecbb38..fec91c063 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7815,10 +7815,13 @@ method steps are:

  • Resolve p with responseObject. -

  • Let error be requestObject's signal's - abort reason if it not undefined. Otherwise, let error be an - "{{AbortError}}" {{DOMException}}. +

  • Return p. + +

    To abort fetch with a promise, request, +responseObject, and an error, run these steps: + +

    1. Let serializedError be the result of calling [$StructuredSerialize$] with error. If that threw an exception, let serializedError be the result of calling [$StructuredSerialize$] with "{{AbortError}}" {{DOMException}}. @@ -7826,13 +7829,6 @@ method steps are:

    2. Set controller's serialized abort reason to serializedError. -

    3. Return p. -

    - -

    To abort fetch with a promise, request, -responseObject, and an error, run these steps: - -

    1. Reject promise with error. From f44930ce8422c941f80d4ad9a5aa656fc49c8b31 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 15 Aug 2022 10:53:20 +0000 Subject: [PATCH 15/28] pass reason to cancelAlgorithm --- fetch.bs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index fec91c063..29026077d 100644 --- a/fetch.bs +++ b/fetch.bs @@ -5669,7 +5669,8 @@ optional boolean forceNewConnection (default false), run these steps: ongoing fetch if it is suspended.

    2. Let cancelAlgorithm be an algorithm that aborts - fetchParams's controller. + fetchParams's controller with reason, given + reason.

    3. Let highWaterMark be a non-negative, non-NaN number, chosen by the user agent. From 122bae5407475ce24aa9d29711f088794e92f220 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Tue, 6 Sep 2022 02:32:48 +0000 Subject: [PATCH 16/28] address comments --- fetch.bs | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/fetch.bs b/fetch.bs index 29026077d..d9ad8aab5 100644 --- a/fetch.bs +++ b/fetch.bs @@ -264,9 +264,9 @@ given a fetch controller controller:

    4. Let error be an "{{AbortError}}" {{DOMException}}, if it is not given. -

    5. Let serializedError be the result of calling [$StructuredSerialize$] with - error. If that threw and exception, let serializedError be the result of calling - [$StructuredSerialize$] with "{{AbortError}}" {{DOMException}}. +

    6. Let serializedError be [$StructuredSerialize$](error). + If that threw an exception, let serializedError be + [$StructuredSerialize$](a new "{{AbortError}}" {{DOMException}}).

    7. Set controller's serialized abort reason to serializedError. @@ -7803,9 +7803,21 @@ method steps are:

      1. If locallyAborted is true, terminate these substeps. -

      2. If response's aborted flag is set, then abort fetch - with p, request, responseObject, and error, and - terminate these substeps. +

      3. If response's aborted flag is set, then: + +

          +
        1. Let error be an "{{AbortError}}" {{DOMException}}. + +

        2. If requestObject's signal's abort reason + is not undefined, set error to requestObject's signal's + abort reason. + +

        3. Abort fetch with p, request, responseObject, and + error. + +

        4. Abort controller with error, and + terminate these substeps. +

      4. If response is a network error, then reject p with a {{TypeError}} and terminate these substeps. @@ -7823,13 +7835,6 @@ method steps are: responseObject, and an error, run these steps:

          -
        1. Let serializedError be the result of calling [$StructuredSerialize$] - with error. If that threw an exception, let serializedError be the result of - calling [$StructuredSerialize$] with "{{AbortError}}" {{DOMException}}. - -

        2. Set controller's serialized abort reason to - serializedError. -

        3. Reject promise with error. From cc54cd63f504478412e2e792480c52844a7fe2fa Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Wed, 7 Sep 2022 07:15:52 +0000 Subject: [PATCH 17/28] rename abort fetch --- fetch.bs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fetch.bs b/fetch.bs index d9ad8aab5..a59782cf2 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7756,7 +7756,7 @@ method steps are: then:

            -
          1. Abort fetch with p, request, null, and requestObject's +

          2. Abort the fetch() call with p, request, null, and requestObject's signal's abort reason.

          3. Return p. @@ -7787,7 +7787,7 @@ method steps are:

            1. Set locallyAborted to true. -

            2. Abort fetch with p, request, responseObject, and +

            3. Abort the fetch() call with p, request, responseObject, and requestObject's signal's abort reason.

            4. If controller is not null, then abort @@ -7812,7 +7812,7 @@ method steps are: is not undefined, set error to requestObject's signal's abort reason. -

            5. Abort fetch with p, request, responseObject, and +

            6. Abort the fetch() call with p, request, responseObject, and error.

            7. Abort controller with error, and @@ -7831,8 +7831,8 @@ method steps are:

            8. Return p.

            -

            To abort fetch with a promise, request, -responseObject, and an error, run these steps: +

            To abort a fetch() call with a +promise, request, responseObject, and an error, run these steps:

            1. From 647f4f52fec9c0e3e88695c1e4b9969cf576054d Mon Sep 17 00:00:00 2001 From: Nidhi Jaju <41948741+nidhijaju@users.noreply.github.com> Date: Wed, 7 Sep 2022 17:09:01 +0900 Subject: [PATCH 18/28] Apply suggestions from code review Co-authored-by: Domenic Denicola --- fetch.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index a59782cf2..9c672ddd9 100644 --- a/fetch.bs +++ b/fetch.bs @@ -265,7 +265,7 @@ given a fetch controller controller:
            2. Let error be an "{{AbortError}}" {{DOMException}}, if it is not given.

            3. Let serializedError be [$StructuredSerialize$](error). - If that threw an exception, let serializedError be + If that threw an exception, catch it, and let serializedError be [$StructuredSerialize$](a new "{{AbortError}}" {{DOMException}}).

            4. Set controller's serialized abort reason to @@ -7831,7 +7831,7 @@ method steps are:

            5. Return p.

            -

            To abort a fetch() call with a +

            To abort a fetch() call with a promise, request, responseObject, and an error, run these steps:

              From 1b86ddc1ca58a2b54383dd34a3ccf5915ecfac02 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Wed, 28 Sep 2022 07:36:30 +0000 Subject: [PATCH 19/28] resolve conflict --- fetch.bs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fetch.bs b/fetch.bs index 1c66b91ae..4f0bf6839 100644 --- a/fetch.bs +++ b/fetch.bs @@ -257,12 +257,12 @@ given a fetch controller controller:

            To abort a fetch controller -controller with optional error: +controller with an optional error:

            1. Set controller's state to "aborted". -

            2. Let error be an "{{AbortError}}" {{DOMException}}, if it is not given. +

            3. Set error to an "{{AbortError}}" {{DOMException}} if it is not given.

            4. Let serializedError be [$StructuredSerialize$](error). If that threw an exception, catch it, and let serializedError be @@ -5805,8 +5805,8 @@ optional boolean forceNewConnection (default false), run these steps:

            5. Set response's aborted flag.

            6. If stream is readable, - error stream with an - "AbortError" {{DOMException}}. + error stream with + controller's serialized abort reason.

          4. Otherwise, if stream is readable, @@ -7857,7 +7857,7 @@ method steps are:

          5. Return p.

          -

          To abort a fetch() call with a +

          To abort a fetch() call with a promise, request, responseObject, and an error, run these steps:

            From b6a779d5986c78e319ea86909efdaf88a0c7034e Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Wed, 28 Sep 2022 08:44:34 +0000 Subject: [PATCH 20/28] fix --- fetch.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index 4f0bf6839..c53a09521 100644 --- a/fetch.bs +++ b/fetch.bs @@ -5805,8 +5805,8 @@ optional boolean forceNewConnection (default false), run these steps:
          1. Set response's aborted flag.

          2. If stream is readable, - error stream with - controller's serialized abort reason. + error stream with fetchParams's + controller's serialized abort reason.

        4. Otherwise, if stream is readable, From 6a0f4aa3fe2d99eb62a61cbba58ad054f182f23a Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Wed, 28 Sep 2022 09:00:58 +0000 Subject: [PATCH 21/28] wrap fetch with --- fetch.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index c53a09521..09a9d6bb5 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7857,7 +7857,7 @@ method steps are:

        5. Return p.

        -

        To abort a fetch() call with a +

        To abort a fetch() call with a promise, request, responseObject, and an error, run these steps:

          From 63ad08136fcec874e7d697f23c1dbd047f578d99 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Fri, 30 Sep 2022 08:56:56 +0000 Subject: [PATCH 22/28] deserialize abort reason --- fetch.bs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/fetch.bs b/fetch.bs index 09a9d6bb5..fe1ae6106 100644 --- a/fetch.bs +++ b/fetch.bs @@ -5804,9 +5804,21 @@ optional boolean forceNewConnection (default false), run these steps:
          1. Set response's aborted flag. -

          2. If stream is readable, - error stream with fetchParams's - controller's serialized abort reason. +

          3. If stream is readable, then: + +

              +
            1. Let deserializedError be an "AbortError" + {{DOMException}}. + +

            2. If fetchParams's controller's + serialized abort reason is non-null, set + deserializedError to [$StructuredDeserialize$](fetchParams's + controller's serialized abort reason). + If that threw an exception or returns undefined, then set deserializedError to + an "AbortError" {{DOMException}}. + +

            3. Error stream with deserializedError. +

        1. Otherwise, if stream is readable, From f86437e07c86bafaa522dffdeb5378f25d74c7ea Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Fri, 30 Sep 2022 09:08:23 +0000 Subject: [PATCH 23/28] use controller's reason --- fetch.bs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/fetch.bs b/fetch.bs index fe1ae6106..b13493e0a 100644 --- a/fetch.bs +++ b/fetch.bs @@ -5807,15 +5807,14 @@ optional boolean forceNewConnection (default false), run these steps:

        2. If stream is readable, then:

            -
          1. Let deserializedError be an "AbortError" - {{DOMException}}. +

          2. Let deserializedError be an "{{AbortError}}" {{DOMException}}.

          3. If fetchParams's controller's serialized abort reason is non-null, set deserializedError to [$StructuredDeserialize$](fetchParams's controller's serialized abort reason). If that threw an exception or returns undefined, then set deserializedError to - an "AbortError" {{DOMException}}. + an "{{AbortError}}" {{DOMException}}.

          4. Error stream with deserializedError.

          @@ -7844,17 +7843,15 @@ method steps are:
        3. If response's aborted flag is set, then:

            -
          1. Let error be an "{{AbortError}}" {{DOMException}}. +

          2. Let deserializedError be an "{{AbortError}}" {{DOMException}}. -

          3. If requestObject's signal's abort reason - is not undefined, set error to requestObject's signal's - abort reason. +

          4. If controller's serialized abort reason is non-null, + set deserializedError to [$StructuredDeserialize$](controller's + serialized abort reason). If that threw an exception or returns + undefined, then set deserializedError to an "{{AbortError}}" {{DOMException}}.

          5. Abort the fetch() call with p, request, responseObject, and - error. - -

          6. Abort controller with error, and - terminate these substeps. + deserializedError.

        4. If response is a network error, then reject p From 38ea956b496e9f1507147da14e6c44445f4ca443 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Fri, 30 Sep 2022 09:12:20 +0000 Subject: [PATCH 24/28] fix indentation --- fetch.bs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fetch.bs b/fetch.bs index b13493e0a..273822369 100644 --- a/fetch.bs +++ b/fetch.bs @@ -5806,18 +5806,18 @@ optional boolean forceNewConnection (default false), run these steps:

        5. If stream is readable, then: -

            -
          1. Let deserializedError be an "{{AbortError}}" {{DOMException}}. - -

          2. If fetchParams's controller's - serialized abort reason is non-null, set - deserializedError to [$StructuredDeserialize$](fetchParams's - controller's serialized abort reason). - If that threw an exception or returns undefined, then set deserializedError to - an "{{AbortError}}" {{DOMException}}. - -

          3. Error stream with deserializedError. -

          +
            +
          1. Let deserializedError be an "{{AbortError}}" {{DOMException}}. + +

          2. If fetchParams's controller's + serialized abort reason is non-null, set + deserializedError to [$StructuredDeserialize$](fetchParams's + controller's serialized abort reason). + If that threw an exception or returns undefined, then set deserializedError to + an "{{AbortError}}" {{DOMException}}. + +

          3. Error stream with deserializedError. +

      5. Otherwise, if stream is readable, From 662fe10129831907783035d496c2232d4ba324a1 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 3 Oct 2022 07:31:45 +0000 Subject: [PATCH 25/28] fix deserialization & make serialized reason default undefined --- fetch.bs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fetch.bs b/fetch.bs index 273822369..fa4015a62 100644 --- a/fetch.bs +++ b/fetch.bs @@ -232,8 +232,8 @@ lt="authentication entry">authentication entries (for HTTP authentication).

        report timing steps (default null)
        Null or an algorithm accepting a global object. -
        serialized abort reason (default null) -
        Null or a serialization from [$StructuredSerialize$]. +
        serialized abort reason (default undefined) +
        Undefined or a serialization from [$StructuredSerialize$].

        To report timing for a @@ -5810,11 +5810,11 @@ optional boolean forceNewConnection (default false), run these steps:

      6. Let deserializedError be an "{{AbortError}}" {{DOMException}}.

      7. If fetchParams's controller's - serialized abort reason is non-null, set + serialized abort reason is not undefined, set deserializedError to [$StructuredDeserialize$](fetchParams's - controller's serialized abort reason). - If that threw an exception or returns undefined, then set deserializedError to - an "{{AbortError}}" {{DOMException}}. + controller's serialized abort reason, + this's relevant Realm). If that threw an exception or returns undefined, then + set deserializedError to an "{{AbortError}}" {{DOMException}}.

      8. Error stream with deserializedError.

      @@ -7845,10 +7845,11 @@ method steps are:
      1. Let deserializedError be an "{{AbortError}}" {{DOMException}}. -

      2. If controller's serialized abort reason is non-null, +

      3. If controller's serialized abort reason is not undefined, set deserializedError to [$StructuredDeserialize$](controller's - serialized abort reason). If that threw an exception or returns - undefined, then set deserializedError to an "{{AbortError}}" {{DOMException}}. + serialized abort reason, relevantRealm). + If that threw an exception or returns undefined, then set deserializedError to an + "{{AbortError}}" {{DOMException}}.

      4. Abort the fetch() call with p, request, responseObject, and deserializedError. From 70ade67887f831a56117615227f07af85e4efcc6 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 3 Oct 2022 07:34:15 +0000 Subject: [PATCH 26/28] fix indentation --- fetch.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index fa4015a62..d9d4710c5 100644 --- a/fetch.bs +++ b/fetch.bs @@ -5813,8 +5813,8 @@ optional boolean forceNewConnection (default false), run these steps: serialized abort reason is not undefined, set deserializedError to [$StructuredDeserialize$](fetchParams's controller's serialized abort reason, - this's relevant Realm). If that threw an exception or returns undefined, then - set deserializedError to an "{{AbortError}}" {{DOMException}}. + this's relevant Realm). If that threw an exception or returns undefined, then + set deserializedError to an "{{AbortError}}" {{DOMException}}.

      5. Error stream with deserializedError.

      From a29fd77d3f1c5904bb6250366a3c1b2ef03d1981 Mon Sep 17 00:00:00 2001 From: Nidhi Jaju Date: Mon, 3 Oct 2022 08:39:30 +0000 Subject: [PATCH 27/28] wrap abort fetch calls in --- fetch.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fetch.bs b/fetch.bs index d9d4710c5..72dd0a7d0 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7793,8 +7793,8 @@ method steps are: then:
        -
      1. Abort the fetch() call with p, request, null, and requestObject's - signal's abort reason. +

      2. Abort the fetch() call with p, request, null, and + requestObject's signal's abort reason.

      3. Return p.

      @@ -7824,8 +7824,8 @@ method steps are:
      1. Set locallyAborted to true. -

      2. Abort the fetch() call with p, request, responseObject, and - requestObject's signal's abort reason. +

      3. Abort the fetch() call with p, request, responseObject, + and requestObject's signal's abort reason.

      4. If controller is not null, then abort controller with requestObject's signal's @@ -7851,8 +7851,8 @@ method steps are: If that threw an exception or returns undefined, then set deserializedError to an "{{AbortError}}" {{DOMException}}. -

      5. Abort the fetch() call with p, request, responseObject, and - deserializedError. +

      6. Abort the fetch() call with p, request, + responseObject, and deserializedError.

    8. If response is a network error, then reject p From 01a87c02fd6afeb27e322892518dfdd3571b6396 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 4 Oct 2022 14:11:14 +0200 Subject: [PATCH 28/28] Go back to null instead of undefined, address logic sharing comment, and deal with realms a bit better --- fetch.bs | 79 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/fetch.bs b/fetch.bs index 72dd0a7d0..3003eff96 100644 --- a/fetch.bs +++ b/fetch.bs @@ -33,6 +33,10 @@ urlPrefix:https://w3c.github.io/hr-time/#;spec:hr-time url:dfn-coarsened-shared-current-time;text:coarsened shared current time url:dfn-unsafe-shared-current-time;text:unsafe shared current time type:typedef;url:dom-domhighrestimestamp;text:DOMHighResTimeStamp + +urlPrefix:https://tc39.es/ecma262/#;type:dfn;spec:ecma-262 + url:realm;text:realm + url:sec-list-and-record-specification-type;text:Record