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

[Fetch-Based API] Handling Request Size Limit #76

Closed
mingyc opened this issue Mar 24, 2023 · 4 comments
Closed

[Fetch-Based API] Handling Request Size Limit #76

mingyc opened this issue Mar 24, 2023 · 4 comments
Labels
api Issue with API specs discussion fetch-based-api Fetch-based API design

Comments

@mingyc
Copy link
Collaborator

mingyc commented Mar 24, 2023

Context: #70 #71

As setting deferSend implies keepalive is also true, such request has to share the same size limit budget as a regular keepalive request’s one: "for each fetch group, the sum of contentLength and inflightKeepaliveBytes <= 64 KB".

To comply with the limit, there are several options:

  1. fetch() throws TypeError whenever the budget has exceeded. Users will not be able to create new pending requests.
  2. The browser forces sending out other existing pending requests, in FIFO order, when the budget has exceeded. For a single request > 64KB, fetch() should still throws TypeError.
  3. Ignore the size limit if BackgroundFetch Permission is enabled for the page.
mingyc added a commit to mingyc/pending-beacon that referenced this issue Mar 24, 2023
- Previous discussions about fetch-based API are in WICG#70, WICG#52, WICG#50, WebKit/standards-positions#85 (comment)
- Related new discussions in WICG#72, WICG#73, WICG#74, WICG#75, WICG#76, WICG#77
@mingyc mingyc added discussion api Issue with API specs labels Mar 24, 2023
mingyc added a commit that referenced this issue Mar 24, 2023
- Previous discussions about fetch-based API are in #70, #52, #50, WebKit/standards-positions#85 (comment)
- Related new discussions in #72, #73, #74, #75, #76, #77
@mingyc mingyc added the fetch-based-api Fetch-based API design label Mar 28, 2023
@mingyc
Copy link
Collaborator Author

mingyc commented Apr 13, 2023

Today's discussion:

  • Proposal 1: Per-Origin quota
    • Flush the earliest queued request as soon as we reach the limit.
    • For a single request > request size limit, fail the request?
  • Proposal 2:
    • Fail all requests made after we reach the limit
  • Refer to compression API
  • Need examples with the new API shape options

cc @noamr

@yoavweiss
Copy link
Collaborator

One thing to be wary of, and that per-origin quota helps a lot with, is weird dynamics that can be created if the quota is shared between multiple 3P vendors on the page.

mingyc added a commit to mingyc/pending-beacon that referenced this issue Jul 4, 2023
mingyc added a commit to mingyc/pending-beacon that referenced this issue Jul 4, 2023
mingyc added a commit to mingyc/pending-beacon that referenced this issue Jul 4, 2023
mingyc added a commit to mingyc/pending-beacon that referenced this issue Jul 4, 2023
mingyc added a commit that referenced this issue Jul 4, 2023
This PR adds overview and example codes for the draft `fetchLater()` API spec from whatwg/fetch#1647

The API will address the discussions in #70 #72 #73 #74 #75 #76.
@mingyc
Copy link
Collaborator Author

mingyc commented Nov 13, 2023

See https://whatpr.org/fetch/1647.html#deferred-fetching:

  1. Let totalScheduledDeferredBytesForOrigin be 0.

...

  1. If totalScheduledDeferredBytesForOrigin is greater than 64 kilobytes, then throw a "QuotaExceededError" DOMException.

@mingyc
Copy link
Collaborator Author

mingyc commented Dec 1, 2023

Subsequent request-related discussion in #87 to avoid confusion

@mingyc mingyc closed this as completed Dec 1, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue with API specs discussion fetch-based-api Fetch-based API design
Projects
None yet
Development

No branches or pull requests

2 participants