Skip to content

processResponseDone should receive a response #1202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Apr 21, 2021
39 changes: 24 additions & 15 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1932,7 +1932,8 @@ message as HTTP/2 does not support them.
<dfn export for=response id=concept-response-cache-state>cache state</dfn> (the empty string or
"<code>local</code>"). Unlesss stated otherwise, it is the empty string.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep this including the comment and instead say something like

This is intended for usage by <cite>Service Workers</cite> and <cite>Resource Timing</cite>.

I guess for Resource Timing we also need opaque responses (that have TAO) to leak this information. I'll have a look if that needs more work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


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

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

<li><p>If <var>fetchParams</var>'s <a for="fetch params">process response done</a> is not null,
then <a>queue a fetch task</a> given <var>fetchParams</var>'s
<a for="fetch params">process response done</a> and <var>fetchParams</var>'s
<a for="fetch params">task destination</a>.
then <a>queue a fetch task</a> to run <var>fetchParams</var>'s
<a for="fetch params">process response done</a> given <var>response</var>,
with <var>fetchParams</var>'s <a for="fetch params">task destination</a>.
</ol>

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

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

<li><p>Let <var>cacheState</var> be <var>response</var>'s <a for=response>cache state</a>.

<li><p>If <var>timingInfo</var> is null, then return.

<li><p>If <var>response</var>'s <a for=response>timing allow passed flag</a> is not set, then set
<var>timingInfo</var> to a new <a for=/>fetch timing info</a> whose
<a for="fetch timing info">start time</a> and
<a for="fetch timing info">post-redirect start time</a> are <var>timingInfo</var>'s
<a for="fetch timing info">start time</a>.
<li>
<p>If <var>response</var>'s <a for=response>timing allow passed flag</a> is not set, then:

<ol>
<li><p>Set <var>timingInfo</var> to a new <a for=/>fetch timing info</a> whose
<a for="fetch timing info">start time</a> and
<a for="fetch timing info">post-redirect start time</a> are <var>timingInfo</var>'s
<a for="fetch timing info">start time</a>.

<li><p>Set <var>cacheState</var> to the empty string.
</ol>

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

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

<li><p><a href="https://github.com/w3c/resource-timing/pull/261">Mark resource timing</a> for
<var>timingInfo</var>, <var>originalURL</var>, <var>initiatorType</var>, and <var>global</var>.
<!-- TODO -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's restore the TODO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<li><p><a for=/>Mark resource timing</a> for <var>timingInfo</var>, <var>originalURL</var>,
<var>initiatorType</var>, <var>global</var>, and <var>cacheState</var>.
</ol>


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

<li><p>Let <var>handleFetchDone</var> be to <a>finalize and report timing</a> with
<var>response</var>, <var>globalObject</var>, and "<code>fetch</code>".
<li><p>Let <var>handleFetchDone</var> given <a for=/>response</a> <var>response</var> be to
<a>finalize and report timing</a> with <var>response</var>, <var>globalObject</var>, and
"<code>fetch</code>".

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