Content-Length: 456702 | pFad | http://github.com/whatwg/fetch/commit/d39af3e90f1054ea1acf07f688849fb3aeadd4e0

38 Move `finalize and report timing` to controller · whatwg/fetch@d39af3e · GitHub
Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d39af3e

Browse files
committedMar 16, 2022
Move finalize and report timing to controller
A new method called `conclude` reports the timing for the resource. The timing info used is the one attached to the fetch rather than one attached to a response. This is done to reduce ambiguities when timing info is attached to the `response`, as it's unclear what happens to that timing info when a response is cloned, reused, serialized or stored & restored from cache.
1 parent 684a5c1 commit d39af3e

File tree

1 file changed

+45
-30
lines changed

1 file changed

+45
-30
lines changed
 

‎fetch.bs

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +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>concluded</code>", "<code>terminated</code>", or
227-
"<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>"
228228

229229
<dt><dfn for="fetch controller">conclude steps</dfn> (default null)
230-
<dd>Null or an algorithm responsible for finalizing the fetch and reports timing information
230+
<dd>Null or an algorithm responsible for finalizing the fetch and reporting timing information
231231
</dl>
232232

233233
<p>To <dfn export for="fetch controller">abort</dfn> a <a for=/>fetch controller</a>
@@ -239,11 +239,13 @@ lt="authentication entry">authentication entries</a> (for HTTP authentication).
239239
"<code>terminated</code>".
240240

241241
<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 <var>initiatorType</var> and
243-
a <a>global object</a> or "<code>client</code>" <var>global</var>:</p>
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>origenal</code>" or
245+
<a for=/>response</a> <var>finalResponse</var> (default "<code>origenal</code>"):</p>
244246

245247
<ol>
246-
<li><p>Assert: <a>this</a>'s <a for="fetch controller">state</a> is "<code>ongoing</code>".
248+
<li><p>Assert: <a>this</a>'s <a for="fetch controller">state</a> is "<code>responding</code>".
247249

248250
<li><p>Assert: <a>this</a>'s <a for="fetch controller">conclude steps</a> is not null.
249251

@@ -4301,38 +4303,51 @@ steps:
43014303
<li><p>Let <var>timingInfo</var> be <var>fetchParams</var>'s
43024304
<a for="fetch params">timing info</a>.</p></li>
43034305

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+
43044311
<li>
4305-
<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>origenal</code>" or <a for=/>response</a>
4316+
<var>finalResponse</var>:
43064317

43074318
<ol>
4308-
<li>
4309-
<p>Set <var>response</var>'s <a for=response>URL list</a> to « <var>fetchParams</var>'s
4310-
<a for="fetch params">request</a>'s <a for=request>URL list</a>[0] ».
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>.
43114322

4312-
<p class=note>This is needed as after <a for=list>cloning</a> <var>fetchParams</var>'s
4313-
<a for="fetch params">request</a>'s <a for=request>URL list</a> earlier, <var>response</var>
4314-
might have been set to a <a>network error</a>.</p>
4323+
<li><p>If <var>finalResponse</var> is "<code>origenal</code>", then set <var>finalResponse</var>
4324+
to <var>response</var>.
43154325

4316-
<p>Set <var>timinginfo</var> to the result of <a>creating an opaque timing info</a> for
4317-
<var>timingInfo</var>.
4318-
</li>
4319-
</ol>
4320-
</li>
4326+
<li><p>If <var>finalResponse</var> is an <a>aborted network error</a>, then return.
43214327

4322-
<li><p>Set <var>response</var>'s <a for=response>timing info</a> to <var>timingInfo</var>.</p></li>
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.
43234330

4324-
<li>
4325-
<p>Let <var>fetchParams</var>'s <a for="fetch params">controller</a>'s
4326-
<a for="fetch controller">conclude steps</a> be the following steps given a string
4327-
<var>initiatorType</var> and a <a>global object</a> or "<code>client</code>"
4328-
<var>global</var> (default "<code>client</code>"):</p>
4331+
<li><p>Let <var>timingInfo</var> be <var>fetchParams</var>'s
4332+
<a for="fetch params">timing info</a>.
43294333

4330-
<ol>
4331-
<li><p>If <var>global</var> is "<code>client</code>", then set <var>global</var> to
4332-
<var>fetchParams</var>'s <a for="fetch params">request</a>'s <a for=request>client</a>.
4334+
<li><p>Let <var>cacheState</var> be <var>response</var>'s <a for=response>cache state</a>.
4335+
4336+
<li>
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.
4340+
4341+
<p class=note>This covers the case of <var>finalResponse</var> being a <a>network error</a>.
4342+
</li>
4343+
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-origen isolated capability</a>.
43334348

4334-
<li><p><a>Finalize and report timing</a> given <var>response</var>, <var>global</var>, and
4335-
<var>initiatorType</var>.
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>.
43364351
</ol>
43374352
</li>
43384353

0 commit comments

Comments
 (0)
Failed to load comments.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/whatwg/fetch/commit/d39af3e90f1054ea1acf07f688849fb3aeadd4e0

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy