Skip to content

Update HTTPFetch algorithm to support new SW Handle Fetch returns #1832

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 43 additions & 26 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ following <a for=struct>items</a>: [[RESOURCE-TIMING]] [[NAVIGATION-TIMING]]
<dt><dfn export for="fetch timing info">final connection timing info</dfn> (default null)
<dd>Null or a <a for=/>connection timing info</a>.

<dt><dfn export for="fetch timing info">service worker timing info</dfn> (default null)
<dd>Null or a <a for=/>service worker timing info</a>.

<dt><dfn export for="fetch timing info">server-timing headers</dfn> (default « »)
<dd>A <a for=/>list</a> of strings.
<dt><dfn export for="fetch timing info">render-blocking</dfn> (default false)
Expand Down Expand Up @@ -5248,48 +5251,61 @@ these steps:
<li><p>Let <var>serviceWorkerStartTime</var> be the <a for=/>coarsened shared current time</a>
given <var>fetchParams</var>'s <a for="fetch params">cross-origin isolated capability</a>.

<li><p>Set <var>response</var> to the result of invoking <a for=/>handle fetch</a> for
<li><p>Let <var>fetchResponse</var> be the result of invoking <a for=/>handle fetch</a> for
<var>requestForServiceWorker</var>, with <var>fetchParams</var>'s
<a for="fetch params">controller</a> and <var>fetchParams</var>'s
<a for="fetch params">cross-origin isolated capability</a>. [[!HTML]] [[!SW]]

<li>
<p>If <var>response</var> is non-null, then:

<ol>
<li><p>Set <var>fetchParams</var>'s <a for="fetch params">timing info</a>'s
<a for="fetch timing info">final service worker start time</a> to
<var>serviceWorkerStartTime</var>.
<p>If <var>fetchResponse</var> is non-null, then:
<ol>
<li><p>If<var>fetchResponse</var> is <a for=/>response</a>, then:
<ol>
<li><p>Set <var>response</var> to <var>fetchResponse</var>.
<li><p>Set <var>fetchParams</var>'s <a for="fetch params">timing info</a>'s
<a for="fetch timing info">final service worker start time</a> to
<var>serviceWorkerStartTime</var>.
<li><p>Set <var>fetchParams</var>'s <a for="fetch params">timing info</a>'s
<a for="fetch timing info">service worker timing info</a> to
<var>response</var>'s <a for="response">service worker timing info</a>.

<li>If <var>request</var>'s <a for=request>body</a> is non-null, then
<a for=ReadableStream>cancel</a> <var>request</var>'s <a for=request>body</a> with undefined.
<li>If <var>request</var>'s <a for=request>body</a> is non-null, then
<a for=ReadableStream>cancel</a> <var>request</var>'s <a for=request>body</a> with undefined.

<li><p>Set <var>internalResponse</var> to <var>response</var>, if <var>response</var> is not a
<a>filtered response</a>; otherwise to <var>response</var>'s
<a for="filtered response">internal response</a>.
<li><p>Set <var>internalResponse</var> to <var>response</var>, if <var>response</var> is not a
<a>filtered response</a>; otherwise to <var>response</var>'s
<a for="filtered response">internal response</a>.

<li>
<p>If one of the following is true
<li>
<p>If one of the following is true

<ul class=brief>
<li><p><var>response</var>'s <a for=response>type</a> is "<code>error</code>"
<ul class=brief>
<li><p><var>response</var>'s <a for=response>type</a> is "<code>error</code>"

<li><p><var>request</var>'s <a for=request>mode</a> is "<code>same-origin</code>" and
<var>response</var>'s <a for=response>type</a> is "<code>cors</code>"
<li><p><var>request</var>'s <a for=request>mode</a> is "<code>same-origin</code>" and
<var>response</var>'s <a for=response>type</a> is "<code>cors</code>"

<li><p><var>request</var>'s <a for=request>mode</a> is not "<code>no-cors</code>" and
<var>response</var>'s <a for=response>type</a> is "<code>opaque</code>"
<li><p><var>request</var>'s <a for=request>mode</a> is not "<code>no-cors</code>" and
<var>response</var>'s <a for=response>type</a> is "<code>opaque</code>"

<li><var>request</var>'s <a for=request>redirect mode</a> is not "<code>manual</code>" and
<var>response</var>'s <a for=response>type</a> is "<code>opaqueredirect</code>"
<li><var>request</var>'s <a for=request>redirect mode</a> is not "<code>manual</code>" and
<var>response</var>'s <a for=response>type</a> is "<code>opaqueredirect</code>"

<li><var>request</var>'s <a for=request>redirect mode</a> is not "<code>follow</code>" and
<var>response</var>'s <a for=response>URL list</a> has more than one item.
</ul>
<li><var>request</var>'s <a for=request>redirect mode</a> is not "<code>follow</code>" and
<var>response</var>'s <a for=response>URL list</a> has more than one item.
</ul>

<p>then return a <a>network error</a>.
<p>then return a <a>network error</a>.
</ol>
<li><p>If<var>fetchResponse</var> is <a for=/>service worker timing info</a>, then:
<ol>
<li><p>Set <var>fetchParams</var>'s <a for="fetch params">timing info</a>'s
<a for="fetch timing info">service worker timing info</a> to
<var>fetchResponse</var>.
</ol>
</ol>
</ol>
</ol>

<li>
<p>If <var>response</var> is null, then:
Expand Down Expand Up @@ -9220,6 +9236,7 @@ Julian Reschke,
Jussi Kalliokoski,
Jxck,
Kagami Sascha Rosylight,
Keita Suzuki,
Keith Yeung,
Kenji Baheux,
Lachlan Hunt,
Expand Down