Skip to content

Reserve/free quota for fetchLater#10903

Merged
annevk merged 3 commits into
mainfrom
fetch-later
Jul 29, 2025
Merged

Reserve/free quota for fetchLater#10903
annevk merged 3 commits into
mainfrom
fetch-later

Conversation

@noamr

@noamr noamr commented Jan 8, 2025

Copy link
Copy Markdown
Contributor

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.

Depends on whatwg/fetch#1647, where the quota logic itself is defined.

(See WHATWG Working Mode: Changes for more details.)


/browsing-the-web.html ( diff )
/document-lifecycle.html ( diff )
/infrastructure.html ( diff )

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.

Depends on whatwg/fetch#1647, where
the quota logic itself is defined.
@noamr noamr requested a review from annevk January 8, 2025 10:55

@annevk annevk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks reasonable to me modulo formatting.

Comment thread source Outdated
@annevk annevk merged commit 80ebad5 into main Jul 29, 2025
@annevk annevk deleted the fetch-later branch July 29, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants