Skip to content

Commit 5fac9e8

Browse files
authored
Pass response's cache state to Resource Timing
And hand processResponseDone a response. Resource Timing PR: w3c/resource-timing#266. Closes #1201. Follow-up: #1215.
1 parent 6453947 commit 5fac9e8

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

fetch.bs

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,8 @@ message as HTTP/2 does not support them.
19321932
<dfn export for=response id=concept-response-cache-state>cache state</dfn> (the empty string or
19331933
"<code>local</code>"). Unlesss stated otherwise, it is the empty string.
19341934

1935-
<p class=note>This is intended solely for usage by service workers. [[SW]]
1935+
<p class=note>This is intended for usage by <cite>Service Workers</cite> and
1936+
<cite>Resource Timing</cite>. [[SW]] [[RESOURCE-TIMING]]
19361937
<!-- If we ever expand the utility of this we need to carefully consider whether filtered responses
19371938
need to mask it, whether the cache API needs to store it, etc. -->
19381939

@@ -3512,7 +3513,7 @@ representing the number of bytes transmitted. If given, <var>processRequestEndOf
35123513
an algorithm accepting no arguments. If given, <var>processResponse</var> must be an algorithm
35133514
accepting a <a for=/>response</a>. If given, <var>processResponseEndOfBody</var> must be an
35143515
algorithm accepting a <a for=/>response</a> and null, failure, or a <a for=/>byte sequence</a>. If
3515-
given, <var>processResponseDone</var> must be an algorithm accepting no arguments.
3516+
given, <var>processResponseDone</var> must be an algorithm accepting a <a for=/>response</a>.
35163517

35173518
<p>An ongoing <a for=/>fetch</a> can be
35183519
<dfn export for=fetch id=concept-fetch-terminate>terminated</dfn> with flag <var>aborted</var>,
@@ -3986,9 +3987,9 @@ steps:
39863987
<a for=request>done flag</a>.
39873988

39883989
<li><p>If <var>fetchParams</var>'s <a for="fetch params">process response done</a> is not null,
3989-
then <a>queue a fetch task</a> given <var>fetchParams</var>'s
3990-
<a for="fetch params">process response done</a> and <var>fetchParams</var>'s
3991-
<a for="fetch params">task destination</a>.
3990+
then <a>queue a fetch task</a> to run <var>fetchParams</var>'s
3991+
<a for="fetch params">process response done</a> given <var>response</var>,
3992+
with <var>fetchParams</var>'s <a for="fetch params">task destination</a>.
39923993
</ol>
39933994

39943995
<p>To <dfn export>finalize and report timing</dfn> given a <a for=/>response</a>
@@ -4003,13 +4004,21 @@ steps:
40034004

40044005
<li><p>Let <var>timingInfo</var> be <var>response</var>'s <a for=response>timing info</a>.
40054006

4007+
<li><p>Let <var>cacheState</var> be <var>response</var>'s <a for=response>cache state</a>.
4008+
40064009
<li><p>If <var>timingInfo</var> is null, then return.
40074010

4008-
<li><p>If <var>response</var>'s <a for=response>timing allow passed flag</a> is not set, then set
4009-
<var>timingInfo</var> to a new <a for=/>fetch timing info</a> whose
4010-
<a for="fetch timing info">start time</a> and
4011-
<a for="fetch timing info">post-redirect start time</a> are <var>timingInfo</var>'s
4012-
<a for="fetch timing info">start time</a>.
4011+
<li>
4012+
<p>If <var>response</var>'s <a for=response>timing allow passed flag</a> is not set, then:
4013+
4014+
<ol>
4015+
<li><p>Set <var>timingInfo</var> to a new <a for=/>fetch timing info</a> whose
4016+
<a for="fetch timing info">start time</a> and
4017+
<a for="fetch timing info">post-redirect start time</a> are <var>timingInfo</var>'s
4018+
<a for="fetch timing info">start time</a>.
4019+
4020+
<li><p>Set <var>cacheState</var> to the empty string.
4021+
</ol>
40134022

40144023
<li><p>Set <var>timingInfo</var>'s <a for="fetch timing info">end time</a> to the
40154024
<a for=/>coarsened shared current time</a> given <var>global</var>'s
@@ -4018,9 +4027,8 @@ steps:
40184027

40194028
<li><p>Set <var>response</var>'s <a for="response">timing info</a> to <var>timingInfo</var>.
40204029

4021-
<li><p><a href="https://github.com/w3c/resource-timing/pull/261">Mark resource timing</a> for
4022-
<var>timingInfo</var>, <var>originalURL</var>, <var>initiatorType</var>, and <var>global</var>.
4023-
<!-- TODO -->
4030+
<li><p><a for=/>Mark resource timing</a> for <var>timingInfo</var>, <var>originalURL</var>,
4031+
<var>initiatorType</var>, <var>global</var>, and <var>cacheState</var>.
40244032
</ol>
40254033

40264034

@@ -7269,8 +7277,9 @@ method steps are:
72697277
<li><p><a lt=terminated for=fetch>Terminate</a> the ongoing fetch with the aborted flag set.
72707278
</ol>
72717279

7272-
<li><p>Let <var>handleFetchDone</var> be to <a>finalize and report timing</a> with
7273-
<var>response</var>, <var>globalObject</var>, and "<code>fetch</code>".
7280+
<li><p>Let <var>handleFetchDone</var> given <a for=/>response</a> <var>response</var> be to
7281+
<a>finalize and report timing</a> with <var>response</var>, <var>globalObject</var>, and
7282+
"<code>fetch</code>".
72747283

72757284
<li>
72767285
<p><a for=/>Fetch</a> <var>request</var> with <a for=fetch><i>processResponseDone</i></a> set to

0 commit comments

Comments
 (0)