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

Add prefetch processing model, including double-key caching privacy protections #4115

Closed
Closed
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
45 changes: 45 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2815,6 +2815,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x="concept-request-replaces-client-id" data-x-href="https://fetch.spec.whatwg.org/#concept-request-replaces-client-id">replaces client id</dfn></li>
<li><dfn data-x="concept-request-initiator" data-x-href="https://fetch.spec.whatwg.org/#concept-request-initiator">initiator</dfn></li>
<li><dfn data-x="concept-request-destination" data-x-href="https://fetch.spec.whatwg.org/#concept-request-destination">destination</dfn></li>
<li><dfn data-x="request-speculative-flag" data-x-href="https://fetch.spec.whatwg.org/#request-speculative-flag">speculative flag</dfn></li>
<li><dfn data-x="request-service-workers-mode" data-x-href="https://fetch.spec.whatwg.org/#request-service-workers-mode">service-workers mode</dfn></li>
<li><dfn data-x="concept-potential-destination" data-x-href="https://fetch.spec.whatwg.org/#concept-potential-destination">potential destination</dfn></li>
<li><dfn data-x="concept-potential-destination-translate" data-x-href="https://fetch.spec.whatwg.org/#concept-potential-destination-translate">translating</dfn> a <span data-x="concept-potential-destination">potential destination</span></li>
<li><dfn data-x="concept-script-like-destination" data-x-href="https://fetch.spec.whatwg.org/#request-destination-script-like">script-like</dfn> <span data-x="concept-request-destination">destinations</span></li>
Expand Down Expand Up @@ -3188,6 +3190,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<dfn data-x-href="https://dom.spec.whatwg.org/#concept-shadow-including-descendant">shadow-including descendant</dfn>, and
<dfn data-x-href="https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-descendant">shadow-including inclusive descendant</dfn> concepts</li>
<li>The <dfn data-x-href="https://dom.spec.whatwg.org/#concept-tree-first-child">first child</dfn> and <dfn data-x-href="https://dom.spec.whatwg.org/#concept-tree-next-sibling">next sibling</dfn> concepts</li>
<li>The <dfn data-x="concept-document-origin" data-x-href="https://dom.spec.whatwg.org/#concept-document-origin"><code>origin</code></dfn></li>
<li>The <dfn data-x-href="https://dom.spec.whatwg.org/#document-element">document element</dfn> concept</li>
<li>The <dfn data-x-href="https://dom.spec.whatwg.org/#in-a-document-tree">in a document tree</dfn>, <dfn data-x-href="https://dom.spec.whatwg.org/#in-a-document">in a document</dfn> (legacy), and <dfn data-x-href="https://dom.spec.whatwg.org/#connected">connected</dfn> concepts</li>
<li>The <dfn data-x="concept-slot" data-x-href="https://dom.spec.whatwg.org/#concept-slot">slot</dfn> concept, and its <dfn data-x="slot-name" data-x-href="https://dom.spec.whatwg.org/#slot-name">name</dfn> and <dfn data-x-href="https://dom.spec.whatwg.org/#slot-assigned-nodes">assigned nodes</dfn></li>
Expand Down Expand Up @@ -24694,6 +24697,48 @@ document.body.appendChild(wbr);</code></pre>
keyword.</p>


<p>The <span>linked resource fetch setup steps</span> for this type of linked resource, given a
<code>link</code> element <var>el</var> and <span data-x="concept-request">request</span>
<var>request</var>, are:</p>

<ol>
<li><p>Set <var>request</var>'s <span data-x="concept-request-initiator">initiator</span>
to <code data-x="">prefetch</code>.</p></li>
domfarolino marked this conversation as resolved.
Show resolved Hide resolved

<li><p>Set <var>request</var>'s <span data-x="request-speculative-flag">speculative</span> flag
to true.</p></li>
domfarolino marked this conversation as resolved.
Show resolved Hide resolved

<li><p>Let <var>as</var> be the current state of <var>el</var>'s <code
data-x="attr-link-as">as</code> attribute.</p></li>

<li><p>Set <var>request</var>'s <span data-x="concept-request-destination">destination</span>
to the result of <span data-x="concept-potential-destination-translate">translating</span>
<var>as</var>.</p></li>

<li>
<p>If the browser is using both the <var>request</var>'s <span
data-x="concept-request-url">URL</span> and the
<span>top-level browsing context</span>'s <span>active document</span>'s <span
data-x="concept-document-origin">origin</span> as cache keys for <var>request</var>, then:</p>
Copy link
Member

Choose a reason for hiding this comment

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

This is a little too vague. Which cache are we talking about?

Also, from your comment it seems this is talking about requestStorageAccess() type of isolation. I suspect we want to land some infrastructure for that first and agree on how it should work generally.

If that were in place, it's not clear to me why we'd modify redirect mode and such. It seems that might affect any cache in place in weird ways.

<ol>
<li><p>If <var>request</var>'s <span
data-x="concept-request-credentials-mode">credentials mode</span> is "include", then return
false.</p></li>
<li><p>If <var>request</var>'s <span
data-x="concept-request-referrer-policy">referrer policy</span> is not "no-referrer", then
return false.</p></li>
<li><p>If <var>request</var>'s <span data-x="concept-request-destination">destination</span>
is not "document", then return false.</p></li>
<li><p>Set <var>request</var>'s <span
data-x="concept-request-redirect-mode">redirect mode</span> to "manual".</p></li>
<li><p>Set <var>request</var>'s <span
data-x="request-service-workers-mode">service workers mode</span> to "none".</p></li>
</ol>
</li>

<li><p>Return true.</p></li>
</ol>

<h5>Link type "<dfn><code data-x="rel-preload">preload</code></dfn>"</h5>

<p>The <code data-x="rel-preload">preload</code> keyword may be used with <code>link</code>
Expand Down