Skip to content

Commit

Permalink
Add more timing iformation about (interim) responses
Browse files Browse the repository at this point in the history
See w3c/resource-timing#345

Since early hints have landed, there are additional useful timestamps
that are currently not exposed:

- First interim response start (e.g. when we received a 103)
  as a different timestamp from the final response start
  (e.g. when we received the 200)

- Final headers received (when the last header has been received and
  we're ready for the body)

- First bytes of the body received

The naming in whatwg#345 is not finalized yet, but it's clear that these
are the 3 interesting timestamps. This PR exposes those for later
use by resource timing.
  • Loading branch information
noamr committed Sep 2, 2022
1 parent 9bb2ded commit dc4e6d9
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ following <a for=struct>items</a>: [[RESOURCE-TIMING]] [[NAVIGATION-TIMING]]
<dt><dfn export for="fetch timing info">post-redirect start time</dfn> (default 0)
<dt><dfn export for="fetch timing info">final service worker start time</dfn> (default 0)
<dt><dfn export for="fetch timing info">final network-request start time</dfn> (default 0)
<dt><dfn export for="fetch timing info">first interim network-response start time</dfn> (default 0)
<dt><dfn export for="fetch timing info">final network-response start time</dfn> (default 0)
<dt><dfn export for="fetch timing info">final network-response headers end time</dfn> (default 0)
<dt><dfn export for="fetch timing info">response body start time</dfn> (default 0)
<dt><dfn export for="fetch timing info">end time</dfn> (default 0)
<dd>A {{DOMHighResTimeStamp}}.

Expand Down Expand Up @@ -5528,22 +5531,32 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
<p>While true:

<ol>
<li><p>If <var>timingInfo</var>'s
<a for="fetch timing info">final network-response start time</a> is 0, then set
<var>timingInfo</var>'s <a for="fetch timing info">final network-response start time</a> to
<li><p>Set <var>timingInfo</var>'s
<a for="fetch timing info">final network-response start time</a> to the
<a for=/>coarsened shared current time</a> given <var>fetchParams</var>'s
<a for="fetch params">cross-origin isolated capability</a>, immediately after the user
agent's HTTP parser receives the first byte of the response (e.g., frame header bytes for
HTTP/2 or response status line for HTTP/1.x).

<li><p>Wait until all the HTTP response headers are transmitted.

<li><p>Set <var>timingInfo</var>'s
<a for="fetch timing info">final network-response headers end time</a> to
<a for=/>coarsened shared current time</a> given <var>fetchParams</var>'s
<a for="fetch params">cross-origin isolated capability</a>.

<li><p>Let <var>status</var> be the HTTP response's status code.

<li>
<p>If <var>status</var> is in the range 100 to 199, inclusive:

<ol>
<li><p>If <var>timingInfo</var>'s
<a for="fetch timing info">first interim network-response start time</a> is 0, then set
<var>timingInfo</var>'s
<a for="fetch timing info">first interim network-response start time</a> to
<var>timingInfo</var>'s <a for="fetch timing info">final network-response start time</a>.

<li><p>If <var>status</var> is 101, <a for=iteration>break</a>.

<li><p>If <var>status</var> is 103 and <var>fetchParams</var>'s
Expand Down Expand Up @@ -5723,6 +5736,13 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
<p>If one or more bytes have been transmitted from <var>response</var>'s message body, then:

<ol>
<li><p>If <var>fetchParams</var>'s <a for="fetch params">timing info</a>'s
<a for="fetch timing info">response body start time</a> is 0, then set
<var>fetchParams</var>'s <a for="fetch params">timing info</a>'s
<a for="fetch timing info">response body start time</a> to the
<a for=/>coarsened shared current time</a> given <var>fetchParams</var>'s
<a for="fetch params">cross-origin isolated capability</a>.

<li><p>Let <var>bytes</var> be the transmitted bytes.

<li><p>Let <var>codings</var> be the result of <a>extracting header list values</a> given
Expand Down

0 comments on commit dc4e6d9

Please sign in to comment.