diff --git a/xhr.bs b/xhr.bs index 4f7cdd7..b5c3cb4 100644 --- a/xhr.bs +++ b/xhr.bs @@ -839,8 +839,7 @@ return this's cross-origin credentials.
  1. Set this's response to response. -

  2. Handle errors for this and this's - response. +

  3. Handle errors for this.

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

  5. If this's state is not headers received, then return.

  6. If this's response's body is null, - then run handle response end-of-body for this and this's - response, and then return. + then run handle response end-of-body for this and return.

  7. Let processBodyChunk given bytes be these steps: @@ -879,10 +877,16 @@ return this's cross-origin credentials.

  • Let processEndOfBody be this step: run handle response end-of-body for - this and this's response. + this. -

  • Let processBodyError be this step: run handle errors for this - and this's response. +

  • +

    Let processBodyError be these steps: + +

      +
    1. Set this's response to a network error. + +

    2. Run handle errors for this. +

  • Incrementally read this's response's body, given processBodyChunk, processEndOfBody, @@ -916,18 +920,17 @@ return this's cross-origin credentials.

    1. If this's relevant settings object has a responsible document which is not allowed to use the "sync-xhr" feature, then run - handle response end-of-body for this and a network error, and then return. - -

    2. Let response be a network error. + handle response end-of-body for this and return.

    3. Let processedResponse be false.

    4. -

      Let processResponseEndOfBody, given a fetchResponse and +

      Let processResponseEndOfBody, given a response and nullOrFailureOrBytes, be these steps:

        -
      1. Set response to fetchResponse. +

      2. If nullOrFailureOrBytes is not failure, then set this's + response to response.

      3. If nullOrFailureOrBytes is a byte sequence, then append nullOrFailureOrBytes to this's received bytes. @@ -949,31 +952,24 @@ return this's cross-origin credentials.

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

      5. Run handle response end-of-body for this and response. +

      6. Run handle response end-of-body for this.

    To handle response end-of-body for an -{{XMLHttpRequest}} object xhr and a response response, run these -steps: +{{XMLHttpRequest}} object xhr, run these steps:

      -
    1. If xhr's synchronous flag is set, then set xhr's - response to response. - -

    2. Handle errors for xhr and response. +

    3. Handle errors for xhr.

    4. If xhr's response is a network error, then return. -

    5. If xhr's synchronous flag is unset, then update xhr's - response's body using response. -

    6. Let transmitted be xhr's received bytes's length. -

    7. Let length be response's body's - total bytes. +

    8. Let length be xhr's response's + body's total bytes.

    9. If xhr's synchronous flag is unset, then fire a progress event named progress at xhr with transmitted and @@ -992,8 +988,7 @@ steps: transmitted and length.

    -

    To handle errors for an {{XMLHttpRequest}} object xhr and a -response response, run these steps: +

    To handle errors for an {{XMLHttpRequest}} object xhr, run these steps:

    1. If xhr's send() flag is unset, then return. @@ -1002,25 +997,13 @@ steps: for xhr, timeout, and "{{TimeoutError!!exception}}" {{DOMException}}. -

    2. If response is a network error, then run the request error steps - for xhr, error, and "{{NetworkError!!exception}}" - {{DOMException}}. - -

    3. -

      Otherwise, if response's body's stream is - errored, then: - -

        -
      1. Set xhr's state to done. - -

      2. Unset xhr's send() flag. - -

      3. Set xhr's response to a network error. -

      +
    4. Otherwise, if xhr's response's + aborted flag is set, run the request error steps for xhr, + abort, and "{{AbortError!!exception}}" {{DOMException}}. -

    5. Otherwise, if xhr's response's aborted flag is - set, then run the request error steps for xhr, abort, - and "{{AbortError!!exception}}" {{DOMException}}. +

    6. Otherwise, if xhr's response's is a + network error, run the request error steps for xhr, + error, and "{{NetworkError!!exception}}" {{DOMException}}.

    The request error steps for an {{XMLHttpRequest}} object xhr,