Skip to content
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

Webdriver cache mode #1756

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
57 changes: 52 additions & 5 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,11 @@ Unless stated otherwise, it is false.

<p class=note>This is for exclusive use by HTML's navigate algorithm. [[!HTML]]

<p>A <a for=/>request</a> has an associated <dfn export for=request>WebDriver navigation id</dfn>
Copy link

Choose a reason for hiding this comment

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

is the base branch for this PR https://github.com/whatwg/fetch/pull/1540/files ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

(null or a string). Unless stated otherwise, it is null.

<p class=note>This is for exclusive use by HTML's navigate algorithm. [[!HTML]]

<p>A <a for=/>request</a> has an associated boolean <dfn export for=request>render-blocking</dfn>.
Unless stated otherwise, it is false.

Expand Down Expand Up @@ -2197,6 +2202,15 @@ otherwise, it is unset.
<a for=request>done flag</a>, and <a for=request>timing allow failed flag</a> are used as
bookkeeping details by the <a for=/>fetch</a> algorithm.

<p>A <a for=/>request</a> has an associated
<dfn export for=request id=concept-webdriver-id>WebDriver id</dfn>
which is a unique string automatically set when the <a for=/>request</a> is created.

<p class=note>The [=request/WebDriver id=] is used by WebDriver-BiDi. It remains constant
across all requests resulting from a redirect of an initial request. When a
request is [=request/cloned=], the created request gets a unique
[=request/WebDriver id=]. [[!WEBDRIVER-BIDI]]

<hr>

<p>A <dfn export>subresource request</dfn> is a <a for=/>request</a>
Expand Down Expand Up @@ -2273,7 +2287,9 @@ is to return the result of <a>serializing a request origin</a> with <var>request

<ol>
<li><p>Let <var>newRequest</var> be a copy of <var>request</var>, except for its
<a for=request>body</a>.
<a for=request>body</a> and <a for=request>WebDriver id</a>.

<li><p>Set <var>newRequest</var>'s <a for=request>WebDriver id</a> to a new unique string.

<li><p>If <var>request</var>'s <a for=request>body</a> is non-null, set <var>newRequest</var>'s
<a for=request>body</a> to the result of <a lt=clone for=body>cloning</a> <var>request</var>'s
Expand Down Expand Up @@ -4829,6 +4845,11 @@ steps:
<a for=request>URL</a>, <var>fetchParams</var>'s <a for="fetch params">request</a>'s
<a for=request>initiator type</a>, <var>global</var>, <var>cacheState</var>,
<var>bodyInfo</var>, and <var>responseStatus</var>.

<li><p>If <var>response</var> is a <a>network error</a>, run
the <a>WebDriver BiDi fetch error</a> steps with <var>request</var>. Otherwise
run the <a>WebDriver BiDi response completed</a> steps with
<var>request</var> and <var>response</var>.
</ol>

<li>
Expand Down Expand Up @@ -5170,6 +5191,13 @@ these steps:
<a>filtered response</a>; otherwise to <var>response</var>'s
<a for="filtered response">internal response</a>.

<li><p>Run the [=WebDriver BiDi response started=] steps with
<var>request</var> and <var>response</var>.
<!-- Service Workers is responsible for emmitting the WebDriver BiDi
request events in this case. That's necessary to ensure that the events are
only generated if the service worker will handle the fetch, and to get the
correct event ordering in the case of network fallback -->

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

Expand Down Expand Up @@ -5209,6 +5237,8 @@ these steps:
<li>There is at least one <a for=list>item</a> in the <a>CORS-unsafe request-header names</a>
with <var>request</var>'s <a for=request>header list</a> for which there is no
<a>header-name cache entry match</a> using <var>request</var>.

<li><p><a>WebDriver BiDi cache behavior</a> with <var>request</var> is "<code>bypass</code>".
</ul>

<p>Then:
Expand Down Expand Up @@ -5297,8 +5327,12 @@ these steps:

<dt>"<code>follow</code>"
<dd>
<ol><li><p>Set <var>response</var> to the result of running <a>HTTP-redirect fetch</a> given
<var>fetchParams</var> and <var>response</var>.</ol>
<ol>
<li>Run the <a>WebDriver BiDi response completed</a> steps with <var>request</var> and
<var>response</var>.
<li><p>Set <var>response</var> to the result of running <a>HTTP-redirect fetch</a> given
<var>fetchParams</var> and <var>response</var>.
</ol>
</dl>
<!-- not resetting internalResponse since it's no longer used anyway -->
</ol>
Expand Down Expand Up @@ -5583,6 +5617,9 @@ run these steps:
<a>default `<code>User-Agent</code>` value</a>) to <var>httpRequest</var>'s
<a for=request>header list</a>.

<li><p>If <a>WebDriver BiDi cache behavior</a> with <var>request</var> is "<code>bypass</code>, then
set <var>httpRequest</var>'s <a for=request>cache mode</a> to "<code>no-store</code>".

<li><p>If <var>httpRequest</var>'s <a for=request>cache mode</a> is "<code>default</code>" and
<var>httpRequest</var>'s <a for=request>header list</a> <a for="header list">contains</a>
`<code>If-Modified-Since</code>`,
Expand Down Expand Up @@ -5704,6 +5741,10 @@ run these steps:
<p class=note>This intentionally does not depend on <var>httpRequest</var>'s
<a for=request>credentials mode</a>.

<!-- After this point the request is not further modified before being either
retrieved from the cache or sent -->
<li><p>Run the <a>WebDriver BiDi before request sent</a> steps with <var>request</var>.

<li><p>Set <var>httpCache</var> to the result of <a>determining the HTTP cache partition</a>,
given <var>httpRequest</var>.

Expand Down Expand Up @@ -5799,6 +5840,8 @@ run these steps:
<li><p><a>If aborted</a>, then return the <a for=/>appropriate network error</a> for
<var>fetchParams</var>.

<li><p>If <var>response</var> is not null, run the <a>WebDriver BiDi response
started</a> steps with <var>request</var> and <var>response</var>.

<!-- If response is still null, we require a forwarded request. -->
<li>
Expand Down Expand Up @@ -6062,6 +6105,9 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:

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

<li><p>Run the [=WebDriver BiDi response started=] steps with
|request| and |response|.

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

<li>
Expand Down Expand Up @@ -6454,8 +6500,9 @@ populates the <a>CORS-preflight cache</a> to minimize the number of these
<li><p>If <var>max-age</var> is greater than an imposed limit on
<a for="cache entry">max-age</a>, then set <var>max-age</var> to the imposed limit.

<li><p>If the user agent does not provide for a <a lt="CORS-preflight cache">cache</a>, then
return <var>response</var>.
<li><p>If the user agent does not provide for a <a lt="CORS-preflight cache">cache</a>,
or <a>WebDriver BiDi cache behavior</a> with <var>request</var> is "<code>bypass</code>",
then return <var>response</var>.

<li><p>For each <var>method</var> in <var>methods</var> for which there is a
<a>method cache entry match</a> using <var>request</var>, set matching entry's
Expand Down
Loading