Skip to content

Commit 80ebad5

Browse files
authored
Reserve/free quota for fetchLater()
The logic for deferred fetching (the `fetchLater` function), as defined in the fetch spec, specifies a "quota" which is shared with between a document and its direct same-origin descendants. For this logic to work in a secure way, the quota needs to be: - reserved when a frame-initiated navigation starts. This way, the container document can only reserve quota based on URLs it knows it navigates to. - freed if the document ends up being same origin with its container, upon document creation. This ensures quota is handled correctly in the case of redirects. This PR adds those two calls: - Call "reserve" on navigation, based on `sourceDocument`. - Call "potentially free" on document creation. Builds on whatwg/fetch#1647, where the quota logic itself is defined.
1 parent 8119cac commit 80ebad5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

source

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,6 +2624,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
26242624
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#byte-sequence-as-a-body">as a body</dfn></li>
26252625
<li><dfn data-x="response-body-info" data-x-href="https://fetch.spec.whatwg.org/#response-body-info">response body info</dfn></li>
26262626
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#resolve-an-origin">resolve an origin</dfn></li>
2627+
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#reserve-deferred-fetch-quota">reserve deferred fetch quota</dfn></li>
2628+
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#reserve-deferred-fetch-quota">potentially free deferred fetch quota</dfn></li>
26272629
<li>
26282630
<dfn data-x="concept-response"
26292631
data-x-href="https://fetch.spec.whatwg.org/#concept-response">response</dfn> and its
@@ -102327,6 +102329,11 @@ location.href = '#foo';</code></pre>
102327102329
data-x="navigate-fragid">navigate to a fragment</span> path.</p>
102328102330
</li>
102329102331

102332+
<li><p>If <var>sourceDocument</var> is <var>navigable</var>'s <span
102333+
data-x="nav-container-document">container document</span>, then <span>reserve deferred fetch
102334+
quota</span> for <var>navigable</var>'s <span data-x="nav-container">container</span> given
102335+
<var>url</var>'s <span data-x="concept-url-origin">origin</span>.</p></li>
102336+
102330102337
<li>
102331102338
<p><span>In parallel</span>, run these steps:</p>
102332102339

@@ -107235,6 +107242,8 @@ location.href = '#foo';</code></pre>
107235107242
<var>navigationParams</var>'s <span data-x="navigation-params-response">response</span>, and
107236107243
"<code data-x="">pre-media</code>".</p></li>
107237107244

107245+
<li><p><span>Potentially free deferred fetch quota</span> for <var>document</var>.</p></li>
107246+
107238107247
<li><p>Return <var>document</var>.</p></li>
107239107248
</ol>
107240107249

0 commit comments

Comments
 (0)