diff --git a/fetch.bs b/fetch.bs index 530118581..2ccaa704e 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4210,11 +4210,68 @@ steps: response response, run these steps:
    +
  1. +

    If response is a network error, then: + +

      +
    1. +

      Set response's URL list to « fetchParams's + request's URL list[0] ». + +

      This is needed as after cloning fetchParams's + request's URL list earlier, response + might have been set to a network error.

      +
    2. + +
    3. Set response's timing info to the result of + creating an opaque timing info for fetchParams's + timing info.

    4. +
    +
  2. + +
  3. +

    Let processResponseDone be the following steps: + +

      +
    1. Set fetchParams's request's + done flag. + +

    2. If fetchParams's process response done is not null, + then queue a fetch task to run fetchParams's + process response done given response with + fetchParams's task destination. +

    +
  4. +
  5. If fetchParams's process response is non-null, then queue a fetch task to run fetchParams's process response given response, with fetchParams's task destination. +

  6. If response's body is null, then run + processResponseDone. + +

  7. +

    Otherwise:

    + +
      +
    1. Let transformStream be a new a {{TransformStream}}. + +

    2. Let identityTransformAlgorithm be an algorithm which, given chunk, + enqueues chunk in transformStream. + +

    3. Set up transformStream with + transformAlgorithm set to identityTransformAlgorithm and + flushAlgorithm set to processResponseDone. + +

    4. Set response's body to the result of + piping response's + body through transformStream. +

    + +

    This {{TransformStream}} is needed for the purpose of receiving a notification when + the stream reaches its end, and is otherwise an identity transform stream. +

  8. If fetchParams's process response end-of-body is non-null, then: @@ -4237,24 +4294,13 @@ steps:

-

To finalize response given a fetch params fetchParams and a -response response, run these steps: - -

    -
  1. Set fetchParams's request's - done flag. - -

  2. If fetchParams's process response done is not null, - then queue a fetch task to run fetchParams's - process response done given response, - with fetchParams's task destination. -

-

To finalize and report timing given a response response, a global object global, and a string initiatorType (default "other"), run these steps:

    +
  1. If response is an aborted network error, then return. +

  2. If response's URL list is null or empty, then return. @@ -4264,6 +4310,9 @@ steps:

  3. Let cacheState be response's cache state. +

  4. If originalURL's scheme is not an HTTP(S) scheme, then + return. +

  5. If timingInfo is null, then return.

  6. @@ -5596,8 +5645,7 @@ optional boolean forceNewConnection (default false), run these steps:
  7. Otherwise, if the bytes transmission for response's message body is done normally and stream is readable, then - close stream, finalize response for - fetchParams and response, and abort these in-parallel steps. + close stream, and abort these in-parallel steps.

@@ -5605,8 +5653,6 @@ optional boolean forceNewConnection (default false), run these steps:

If aborted, then:

    -
  1. Finalize response for fetchParams and response. -
  2. Let aborted be the termination's aborted flag.