Skip to content

Only consider pending fetch-later requests for deferred fetch quota#1902

Open
TimvdLippe wants to merge 2 commits intowhatwg:mainfrom
TimvdLippe:fetch-later-fixes
Open

Only consider pending fetch-later requests for deferred fetch quota#1902
TimvdLippe wants to merge 2 commits intowhatwg:mainfrom
TimvdLippe:fetch-later-fixes

Conversation

@TimvdLippe
Copy link
Copy Markdown
Contributor

@TimvdLippe TimvdLippe commented Jan 4, 2026

Quota computation shouldn't include aborted or already
completed requests. WPT uses AbortController to ensure
quota is freed up. This also makes sense, since they are
no longer relevant. Therefore, only consider pending
deferred fetches when computing quota.

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


Preview | Diff

There were two missing parts:
1. The body can either be null or empty (it was missing the
empty case)
2. Quota computation shouldn't include aborted or already
completed requests. WPT uses `AbortController` to ensure
quota is freed up. This also makes sense, since they are
no longer relevant. Therefore, only consider pending
deferred fetches when computing quota.
@TimvdLippe
Copy link
Copy Markdown
Contributor Author

FYI @noamr PTAL

@noamr
Copy link
Copy Markdown
Contributor

noamr commented Feb 25, 2026

(2) is fine
Not sure about 1... Isn't posting an empty body a legit use case? The null use case was about not allowing streaming.

@TimvdLippe
Copy link
Copy Markdown
Contributor Author

Well, Chrome currently blocks such requests: https://wpt.fyi/results/fetch/fetch-later/quota/empty-payload.https.window.html?label=experimental&label=master&aligned If I didn't implement that case, Servo wouldn't match Chrome's behaviour.

@noamr
Copy link
Copy Markdown
Contributor

noamr commented Feb 25, 2026

Well, Chrome currently blocks such requests: https://wpt.fyi/results/fetch/fetch-later/quota/empty-payload.https.window.html?label=experimental&label=master&aligned If I didn't implement that case, Servo wouldn't match Chrome's behaviour.

@mingyc the spec only prevents null bodies (streaming) rather than empty... Do you remember why chromium also blocks empty requests?

@TimvdLippe we should check whether this is an implementation oversight or a spec oversight before defaulting to "spec what chromium does"... For the time being I think that the other part of the PR is ok.

@TimvdLippe
Copy link
Copy Markdown
Contributor Author

I wasn't aware of the streaming part. Since the test wasn't marked as tentative, I thought this part of the spec was meant to imply the empty case behaviour. I don't mind either behaviour (not familiar with streaming or anything), so happy to update it to whatever you folks decide.

@TimvdLippe
Copy link
Copy Markdown
Contributor Author

Friendly ping @mingyc on Chromiums perspective

@noamr
Copy link
Copy Markdown
Contributor

noamr commented Mar 24, 2026

Friendly ping @mingyc on Chromiums perspective

I suggest to make the other change and propose a WPT pr to align with the spec re empty request bodies

TimvdLippe added a commit to TimvdLippe/servo that referenced this pull request Mar 24, 2026
Per the spec discussion in [1] we should only check for a length
of `null` and not zero.

[1]: whatwg/fetch#1902

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
servo-wpt-sync pushed a commit to servo/wpt that referenced this pull request Mar 24, 2026
Per the spec discussion in [1] we should only check for a length
of `null` and not zero.

[1]: whatwg/fetch#1902

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
@TimvdLippe
Copy link
Copy Markdown
Contributor Author

Updated this PR and updated Servo + tests, see the WPT export in web-platform-tests/wpt#58726 Please review that PR.

TimvdLippe added a commit to TimvdLippe/servo that referenced this pull request Mar 24, 2026
Per the spec discussion in [1] we should only check for a length
of `null` and not zero.

[1]: whatwg/fetch#1902

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
servo-wpt-sync pushed a commit to servo/wpt that referenced this pull request Mar 24, 2026
Per the spec discussion in [1] we should only check for a length
of `null` and not zero.

[1]: whatwg/fetch#1902

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
@mingyc
Copy link
Copy Markdown

mingyc commented Mar 25, 2026

Sorry about missing this thread

@mingyc the spec only prevents null bodies (streaming) rather than empty... Do you remember why chromium also blocks empty requests?

I roughly remember there was some discussion about posting with empty body should be replaced by a GET request (can't find it now). Isn't null body the same as empty body in this context?

@annevk
Copy link
Copy Markdown
Member

annevk commented Mar 27, 2026

No they are distinct. One has a Content-Length.

@TimvdLippe
Copy link
Copy Markdown
Contributor Author

@annevk @noamr Can I write Chromium and Webkit as interested implementers for this PR?

@TimvdLippe TimvdLippe changed the title Update fetch-later spec according to WPT expectations Do not count aborted fetch-later requests for deferred fetch quota Apr 10, 2026
@TimvdLippe TimvdLippe changed the title Do not count aborted fetch-later requests for deferred fetch quota Only consider pending fetch-later requests for deferred fetch quota Apr 10, 2026
@noamr
Copy link
Copy Markdown
Contributor

noamr commented Apr 10, 2026

@annevk @noamr Can I write Chromium and Webkit as interested implementers for this PR?

yes, though do you mind opening a bug for the 0-length thing?

@TimvdLippe
Copy link
Copy Markdown
Contributor Author

Sure, done: #1920

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.

4 participants