-
Notifications
You must be signed in to change notification settings - Fork 357
Commit 90e1a1e
Deferred fetching: fetchLater()
A deferred fetch would be invoked in one of two scenarios:
- The document is destroyed (the fetch group is terminated).
- A given period of time has passed.
A few constraints:
- Request body streams are not allowed.
- This is only allowed in documents, and only reporting to potentially-trustworthy URLs.
- Deferred fetch requests are limited to 64KB per origin. Exceeding this would immediately throw.
The quota algorithm is a bit intricate, but its default should be somewhat reasonable for all but advanced cases.
- A top level document has 640kb of quota for deferred fetching. This is important to avoid wasting high bandwidth after a tab has been closed. This quota is shared, by default, with the top-level's document same-origin same-agent descendants. The same-agent restriction is important for avoiding race conditions, as same-agent frames are guaranteed to call `fetchLater` in sequence.
- By default, 128kb out of the 640kb quota is reserved for cross-origin or cross-agent iframes. Permissions policy (`deferred-fetch-minimal`) controls that, and the top-level document can disable that allocated quota by disabling that permissions policy.
- Any document can delegate 64kb out of its reserved quota for cross-origin or cross-agent subframes, by explicitly enabling the `deferred-fetch` permissions policy.
- Reserving some of the quota to a cross-origin or cross-agent subframe happens when the frame is being navigated by the container, e.g. setting `src` on an iframe. It is not guaranteed that the subframe would actually be able to use that
quota, as it might end up navigating to a same-origin URL or disable the feature in its own permissions policy. However, the container's document only cares about the initial reserved value for subframes it doesn't have direct access to.
See WICG/pending-beacon#70 for historical context.
Co-authored-by: Anne van Kesteren <[email protected]>1 parent 1d9380b commit 90e1a1eCopy full SHA for 90e1a1e
Expand file treeCollapse file tree
1 file changed
+651
-22
lines changed
0 commit comments