@@ -222,8 +222,12 @@ lt="authentication entry">authentication entries</a> (for HTTP authentication).
222222<a for=struct>items</a> :
223223
224224<dl>
225- < dt > < dfn for ="fetch controller "> state</ dfn > (default "< code > ongoing</ code > ")
226- < dd > "< code > ongoing</ code > ", "< code > terminated</ code > ", or "< code > aborted</ code > "
225+ <dt> <dfn for="fetch controller">state</dfn> (default "<code> requesting</code> ")
226+ <dd> "<code> requesting</code> ", "<code> responding</code> ", "<code> concluded</code> ",
227+ "<code> terminated</code> ", or "<code> aborted</code> "
228+
229+ <dt> <dfn for="fetch controller">conclude steps</dfn> (default null)
230+ <dd> Null or an algorithm responsible for finalizing the fetch and reporting timing information
227231</dl>
228232
229233<p> To <dfn export for="fetch controller">abort</dfn> a <a for=/>fetch controller</a>
@@ -234,6 +238,24 @@ lt="authentication entry">authentication entries</a> (for HTTP authentication).
234238<var> controller</var> , set <var> controller</var> 's <a for="fetch controller">state</a> to
235239"<code> terminated</code> ".
236240
241+ <p> To <dfn export for="fetch controller">conclude</dfn> a <a for=/>fetch controller</a>
242+ <var> controller</var> , perform the following steps given a string
243+ <var> initiatorType</var> , an optional "<code> client</code> " or <a for=/>global object</a>
244+ <var> global</var> (default "<code> client</code> "), and an optional "<code> original</code> " or
245+ <a for=/>response</a> <var> finalResponse</var> (default "<code> original</code> "):</p>
246+
247+ <ol>
248+ <li><p> Assert: <a>this</a> 's <a for="fetch controller">state</a> is "<code> responding</code> ".
249+
250+ <li><p> Assert: <a>this</a> 's <a for="fetch controller">conclude steps</a> is not null.
251+
252+ <li><p> Invoke <a>this</a> 's <a for="fetch controller">conclude steps</a> with
253+ <var> initiatorType</var> and <var> global</var> .
254+
255+ <li><p> Set <var> controller</var> 's <a for="fetch controller">state</a> to
256+ "<code> concluded</code> ".
257+ </ol>
258+
237259<p> A <a for=/>fetch params</a> <var> fetchParams</var> is <dfn for="fetch params">aborted</dfn> if
238260its <a for="fetch params">controller</a> 's <a for="fetch controller">state</a> is
239261"<code> aborted</code> ".
@@ -4278,22 +4300,54 @@ steps:
42784300<a for=/>response</a> <var> response</var> , run these steps:
42794301
42804302<ol>
4303+ <li><p> Let <var> timingInfo</var> be <var> fetchParams</var> 's
4304+ <a for="fetch params">timing info</a> .</p></li>
4305+
4306+ <li><p> Set <var> response</var> 's <a for=response>timing info</a> to <var> timingInfo</var> .</p></li>
4307+
4308+ <li><p> Set <var> fetchParams</var> 's <a for="fetch params">controller</a>' s
4309+ <a for="fetch controller">state</a> to "<code> responding</code> ".
4310+
42814311 <li>
4282- < p > If < var > response</ var > is a < a > network error</ a > , then:
4312+ <p> Set <var> fetchParams</var> 's <a for="fetch params">controller</a>' s
4313+ <a for="fetch controller">conclude steps</a> to the following steps given a string
4314+ <var> initiatorType</var> , a "<code> client</code> " or <a for=/>global object</a>
4315+ <var> global</var> , and an "<code> original</code> " or <a for=/>response</a>
4316+ <var> finalResponse</var> :
42834317
42844318 <ol>
4319+ <li><p> If <var> global</var> is "<code> client</code> ", then set <var> global</var> to
4320+ <var> fetchParams</var> 's <a for="fetch params">request</a>' s <a for=request>client</a> 's
4321+ <a for="environment settings object">global object</a> .
4322+
4323+ <li><p> If <var> finalResponse</var> is "<code> original</code> ", then set <var> finalResponse</var>
4324+ to <var> response</var> .
4325+
4326+ <li><p> If <var> finalResponse</var> is an <a>aborted network error</a> , then return.
4327+
4328+ <li><p> If <var> request</var> 's <a for=request>URL</a>' s <a for=url>scheme</a> is not an
4329+ <a>HTTP(S) scheme</a> , then return.
4330+
4331+ <li><p> Let <var> timingInfo</var> be <var> fetchParams</var> 's
4332+ <a for="fetch params">timing info</a> .
4333+
4334+ <li><p> Let <var> cacheState</var> be <var> response</var> 's <a for=response>cache state</a> .
4335+
42854336 <li>
4286- < p > Set < var > response</ var > 's < a for =response > URL list</ a > to « < var > fetchParams</ var > 's
4287- < a for ="fetch params "> request</ a > 's < a for =request > URL list</ a > [0] ».
4337+ <p> If <var> finalResponse</var> 's <a for=response>timing allow passed flag</a> is not set,
4338+ then set <var> timingInfo</var> to a the result of <a>creating an opaque timing info</a> for
4339+ <var> timingInfo</var> and set <var> cacheState</var> to the empty string.
42884340
4289- < p class =note > This is needed as after < a for =list > cloning</ a > < var > fetchParams</ var > 's
4290- < a for ="fetch params "> request</ a > 's < a for =request > URL list</ a > earlier, < var > response</ var >
4291- might have been set to a < a > network error</ a > .</ p >
4341+ <p class=note> This covers the case of <var> finalResponse</var> being a <a>network error</a> .
42924342 </li>
42934343
4294- < li > < p > Set < var > response</ var > 's < a for =response > timing info</ a > to the result of
4295- < a > creating an opaque timing info</ a > for < var > fetchParams</ var > 's
4296- < a for ="fetch params "> timing info</ a > .</ p > </ li >
4344+ <li><p> Set <var> timingInfo</var> 's <a for="fetch timing info">end time</a> to the
4345+ <a for=/>coarsened shared current time</a> given <var> global</var> 's
4346+ <a>relevant settings object</a> 's
4347+ <a for="environment settings object">cross-origin isolated capability</a> .
4348+
4349+ <li><p> <a for=/>Mark resource timing</a> for <var> timingInfo</var> , <var> request</var> 's
4350+ <a for=request>URL</a> <var> initiatorType</var> , <var> global</var> , and <var> cacheState</var> .
42974351 </ol>
42984352 </li>
42994353
@@ -7636,9 +7690,8 @@ method steps are:
76367690 <var> controller</var> .
76377691 </ol>
76387692
7639- < li > < p > Let < var > handleFetchDone</ var > given < a for =/ > response</ a > < var > response</ var > be to
7640- < a > finalize and report timing</ a > with < var > response</ var > , < var > globalObject</ var > , and
7641- "< code > fetch</ code > ".
7693+ <li><p> Let <var> handleFetchDone</var> be to
7694+ <a for="fetch controller">conclude</a> <var> controller</var> given "<code> fetch</code> ".
76427695
76437696 <li>
76447697 <p><p> Set <var> controller</var> to the result of calling <a for=/>fetch</a> given
0 commit comments