From 2a98f7e5858496eb5f4b2b5489f34d75ad3eb3ce Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 25 Oct 2022 10:09:10 +0200 Subject: [PATCH 1/2] Editorial: minor cleanup in fetch() around aborting Also leave internal notes on the unfortunate duplication of logic. Closes #1187. --- fetch.bs | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/fetch.bs b/fetch.bs index 96c4e129a..4dbd862ae 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7850,21 +7850,31 @@ 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. Assert: controller is non-null. -

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

  5. Abort controller with requestObject's + signal's abort reason. + +

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

  • Set controller to the result of calling fetch given request and processResponse given response being - these substeps: + these steps:

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

    2. If locallyAborted is true, then abort these steps.

    3. If response's aborted flag is set, then: @@ -7876,10 +7886,12 @@ method steps are:

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

    5. Abort these steps.

  • If response is a network error, then reject p - with a {{TypeError}} and terminate these substeps. + with a {{TypeError}} and abort these steps.

  • Set responseObject to the result of creating a {{Response}} object, given response, "immutable", and relevantRealm. @@ -7890,8 +7902,9 @@ method steps are:

  • Return p. -

    To abort a fetch() call 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. @@ -7899,15 +7912,19 @@ method steps are:

      This is a no-op if promise has already fulfilled. -

    2. If request's body is not null and is +

    3. If request's body is non-null and is readable, then cancel request's body with error.

    4. If responseObject is null, then return. +

    5. Let response be responseObject's response. -

    6. If response's body is not null and is +

    7. If response's body is non-null and is readable, then error response's body with error.

    From edf9a183342b215787d652ccb5d323e0d335c970 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 26 Oct 2022 09:24:39 +0200 Subject: [PATCH 2/2] Update fetch.bs Co-authored-by: Domenic Denicola --- fetch.bs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index 4dbd862ae..63506d8df 100644 --- a/fetch.bs +++ b/fetch.bs @@ -7903,8 +7903,7 @@ method steps are:

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