KEMBAR78
Reserve/free quota for `fetchLater` by noamr · Pull Request #10903 · whatwg/html · GitHub
Skip to content

Conversation

@noamr
Copy link
Collaborator

@noamr noamr commented Jan 8, 2025

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
Copy link
Member

@annevk annevk left a comment

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.

@annevk annevk merged commit 80ebad5 into main Jul 29, 2025
2 checks passed
@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