From 565bc63082454242445194de0964b3a9fdfd4643 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Thu, 11 Feb 2021 08:20:24 +0100 Subject: [PATCH] address part of the review --- xhr.bs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/xhr.bs b/xhr.bs index 7b197c0..674734f 100644 --- a/xhr.bs +++ b/xhr.bs @@ -797,8 +797,7 @@ return this's cross-origin credentials.

Let processRequestBody, given a request, be these steps:

    -
  1. If not roughly 50ms have passed since these steps were last invoked, - terminate these steps. +

  2. If not roughly 50ms have passed since these steps were last invoked, then return.

  3. If this's upload listener flag is set, then fire a progress event named progress at this's upload object with @@ -815,7 +814,7 @@ return this's cross-origin credentials.

    1. Set this's upload complete flag. -

    2. If this's upload listener flag is unset, then terminate these steps. +

    3. If this's upload listener flag is unset, then return.

    4. Let transmitted be request's body's @@ -842,7 +841,8 @@ return this's cross-origin credentials.

      1. Set this's response to response. -

      2. Handle errors fo this and response. +

      3. Handle errors for this and this's + response.

      4. If this's response is a network error, then return. @@ -873,8 +873,7 @@ return this's cross-origin credentials.

        1. Append chunk to this's received bytes. -

        2. If not roughly 50ms have passed since these steps were last invoked, then abort - these steps. +

        3. If not roughly 50ms have passed since these steps were last invoked, then return.

        4. If this's state is headers received, then set this's state to loading. @@ -935,7 +934,7 @@ return this's cross-origin credentials.

        5. Let response be a network error. -

        6. Let doesNotBlockTask be false. +

        7. Let processedResponse be false.

        8. Let processResponse, given a fetchResponse, be these steps: @@ -943,16 +942,20 @@ return this's cross-origin credentials.

          1. Set response to fetchResponse. -

          2. Set doesNotBlockTask to true. +

          3. Set processedResponse to true.

        9. Fetch req with processResponse set to processResponse and useParallelQueue set to true. -

        10. Wait until either doesNotBlockTask is true or this's timeout is - not 0 and this's timeout milliseconds have passed since now. +

        11. Let now be the present time. + -

        12. If doesNotBlockTask is false, then set this's timed out flag and +

        13. Pause until either processedResponse is true or this's + timeout is not 0 and this's timeout milliseconds have passed since + now. + +

        14. If processedResponse is false, then set this's timed out flag and terminate fetching.

        15. If response's body is null, then run @@ -967,7 +970,7 @@ return this's cross-origin credentials.

        16. Let promise be the result of reading all bytes from reader. -

        17. Wait for promise to be fulfilled or rejected. +

        18. Pause until promise is fulfilled or rejected.

        19. If promise is fulfilled with bytes, then append bytes to this's received bytes.