Skip to content

Commit

Permalink
Also move timing allow passed flag and cacheState to fetch params
Browse files Browse the repository at this point in the history
  • Loading branch information
noamr committed Oct 12, 2021
1 parent 2d92e56 commit a9c1380
Showing 1 changed file with 18 additions and 28 deletions.
46 changes: 18 additions & 28 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,15 @@ lt="authentication entry">authentication entries</a> (for HTTP authentication).
<dd>Null, a <a for=/>global object</a>, or a <a for=/>parallel queue</a>.

<dt><dfn for="fetch params">cross-origin isolated capability</dfn> (default false)
<dt><dfn for="fetch params">timing info reported</dfn> (default false)
<dt><dfn for="fetch params">timing allow passed</dfn> (default false)
<dd>A boolean.

<dt><dfn for="fetch params">timing info</dfn>
<dd>A <a for=/>fetch timing info</a>.

<dt><dfn for="fetch params">timing info reported</dfn> (default false)
<dd>A boolean.
<dt><dfn for="fetch params">cache state</dfn> (default the empty string)
<dd>The empty string, "<code>local</code>", or "<code>validated</code>"
</dl>

<p>A <dfn export>fetch timing info</dfn> is a <a for=/>struct</a> used to maintain timing
Expand Down Expand Up @@ -2012,11 +2014,6 @@ message as HTTP/2 does not support them.
<p class=note>The <a for=body>source</a> and <a for=body>length</a> concepts of a network's
<a for=/>response</a>'s <a for=response>body</a> are always null.

<p>A <a for=/>response</a> has an associated
<dfn export for=response id=concept-response-cache-state>cache state</dfn> (the empty string,
"<code>local</code>", or "<code>validated</code>"). Unlesss stated otherwise, it is the empty
string.

<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
Expand All @@ -2040,10 +2037,6 @@ initially unset.
being provided to an API that didn't make a range request. See the flag's usage for a detailed
description of the attack.

<p>A <a for=/>response</a> has an associated
<dfn for=response id=concept-response-timing-allow-passed>timing allow passed flag</dfn>, which is
initially unset.

<p class=note>This is used so that the caller to a fetch can determine if sensitive timing data is
allowed on the resource fetched by looking at the flag of the response returned. Because the flag on
the response of a redirect has to be set if it was set for previous responses in the redirect chain,
Expand Down Expand Up @@ -4045,7 +4038,7 @@ steps:
blob URLs, service workers, HTTP cache, HTTP network, etc. -->

<li><p>If <var>request</var>'s <a for=request>timing allow failed flag</a> is unset, then set
<var>internalResponse</var>'s <a for=response>timing allow passed flag</a>.
<var>fetchParams</var>'s <a for="fetch params">timing allow passed</a> to true.

<li>
<p>If <var>response</var> is not a <a>network error</a> and any of the following returns
Expand Down Expand Up @@ -4180,9 +4173,8 @@ steps:
<var>controller</var>, <a for=fetch>terminate</a> the ongoing fetch with the aborted flag set.</p>

<p>To <dfn for="fetch controller" export>report timing</dfn> for a <a for=/>fetch controller</a>
<var>controller</var>, given a <a for=/>response</a> <var>response</var>, a
<a for=/>global object</a> <var>global</var>, and a <a for=/>string</a> <var>initiatorType</var>
(default "<code>other</code>"), run these steps:
<var>controller</var>, given a <a for=/>global object</a> <var>global</var>, and a
<a for=/>string</a> <var>initiatorType</var> (default "<code>other</code>"), run these steps:

<ol>
<li>Let <var>fetchParams</var> be <var>controller</var>'s
Expand All @@ -4193,15 +4185,12 @@ steps:

<li><p>Set <var>fetchParams</var>'s <a for="fetch params">timing info reported</a> to true.

<li><p>Let <var>originalURL</var> be <var>fetchParams</var>'s
<a for="fetch params">request</a>'s <a for=request>URL</a>.

<li><p>Let <var>timingInfo</var> be <var>fetchParams</var> <a for="fetch params">timing info</a>.

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

<li>
<p>If <var>response</var>'s <a for=response>timing allow passed flag</a> is not set, then:
<p>If <var>fetchParams</var>'s <a for="fetch params">timing allow passed</a> is false, then:

<ol>
<li><p>Set <var>timingInfo</var> to a the result of <a>creating an opaque timing info</a> for
Expand All @@ -4215,8 +4204,9 @@ steps:
<a>relevant settings object</a>'s
<a for="environment settings object">cross-origin isolated capability</a>.

<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>.
<li><p><a for=/>Mark resource timing</a> for <var>timingInfo</var>, <var>fetchParams</var>'s
<a for="fetch params">request</a>'s <a for=request>URL</a>, <var>initiatorType</var>,
<var>global</var>, and <var>cacheState</var>.
</ol>


Expand Down Expand Up @@ -4963,7 +4953,7 @@ steps. They return a <a for=/>response</a>.
<ol>
<li><p>Set <var>response</var> to <var>storedResponse</var>.

<li><p>Set <var>response</var>'s <a for=response>cache state</a> to "<code>local</code>".
<li><p>Set <var>fetchParams</var>'s <a for="fetch params">cache state</a> to "<code>local</code>".

<li><p>Let <var>revalidateRequest</var> be a <a for=request>clone</a> of
<var>request</var>.
Expand Down Expand Up @@ -5016,7 +5006,7 @@ steps. They return a <a for=/>response</a>.
chapter of <cite>HTTP Caching</cite> [[!HTTP-CACHING]].

<li><p>Otherwise, set <var>response</var> to <var>storedResponse</var> and set
<var>response</var>'s <a for=response>cache state</a> to "<code>local</code>".
<var>fetchParams</var>'s <a for="fetch params">cache state</a> to "<code>local</code>".
</ol>
</ol>
</ol>
Expand Down Expand Up @@ -5066,7 +5056,8 @@ steps. They return a <a for=/>response</a>.

<li><p>Set <var>response</var> to <var>storedResponse</var>.

<li><p>Set <var>response</var>'s <a for=response>cache state</a> to "<code>validated</code>".
<li><p>Set <var>fetchParams</var>'s <a for="fetch params">cache state</a> to
"<code>validated</code>".

<li><p><a for=/>Update timing info from stored response</a> given <var>fetchParams</var>'s
<a for="fetch params">timing info</a> and <var>response</var>.
Expand Down Expand Up @@ -7472,9 +7463,8 @@ method steps are:
<li><p><a for="fetch controller">Abort</a> <var>fetchController</var>.
</ol>

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

<li>
<p>Set <var>fetchController</var> to the result of <a lt=fetch for=/>fetching</a>
Expand Down

0 comments on commit a9c1380

Please sign in to comment.