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:
If response is a network error, then: + +
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.
+Set response's timing info to the result of + creating an opaque timing info for fetchParams's + timing info.
Let processResponseDone be the following steps: + +
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. +
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. +
If response's body is null, then run + processResponseDone. + +
Otherwise:
+ +Let transformStream be a new a {{TransformStream}}. + +
Let identityTransformAlgorithm be an algorithm which, given chunk, + enqueues chunk in transformStream. + +
Set up transformStream with + transformAlgorithm set to identityTransformAlgorithm and + flushAlgorithm set to processResponseDone. + +
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. +
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: - -
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:
If response is an aborted network error, then return. +
If response's URL list is null or empty, then return. @@ -4264,6 +4310,9 @@ steps:
Let cacheState be response's cache state. +
If originalURL's scheme is not an HTTP(S) scheme, then + return. +
If timingInfo is null, then return.
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.
If aborted, then:
Let aborted be the termination's aborted flag.