Skip to content

fix ReadableStream.from() cancel behavior per WPT spec#5794

Merged
anonrig merged 10 commits intomainfrom
yagiz/fix-cancel-wpt
Feb 23, 2026
Merged

fix ReadableStream.from() cancel behavior per WPT spec#5794
anonrig merged 10 commits intomainfrom
yagiz/fix-cancel-wpt

Conversation

@anonrig
Copy link
Copy Markdown
Member

@anonrig anonrig commented Dec 29, 2025

This change fixes 3 edge cases in ReadableStream.from cancel behavior.

  1. When iterator's return property exists but is not callable, cancel now rejects with TypeError.
  2. When return rejects, the rejection is now propagated directly without calling throw on the iterator.
  3. When return fulfills with a non-object, the error is now properly propagated.

@anonrig anonrig requested a review from jasnell December 29, 2025 19:54
@anonrig anonrig requested review from a team as code owners December 29, 2025 19:54
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 29, 2025

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@anonrig anonrig force-pushed the yagiz/fix-cancel-wpt branch from 770b7d6 to b25e45c Compare December 29, 2025 20:11
@jasnell
Copy link
Copy Markdown
Collaborator

jasnell commented Dec 29, 2025

The plan is to eventually add a default-on date for pedanticWpt, we're just not there yet.

Copy link
Copy Markdown
Collaborator

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

I believe this should be addressed in the impl of return_(...) more generally rather than being specific to ReadableStream.from().

@anonrig anonrig force-pushed the yagiz/fix-cancel-wpt branch from 6fd01d4 to 59907b7 Compare December 29, 2025 23:19
@jasnell
Copy link
Copy Markdown
Collaborator

jasnell commented Dec 29, 2025

It would be good to update the generator tests directly in addition to just enabling the streams related wpts.

@anonrig anonrig force-pushed the yagiz/fix-cancel-wpt branch from 59907b7 to c041446 Compare December 30, 2025 15:19
@anonrig anonrig enabled auto-merge December 30, 2025 15:19
@anonrig
Copy link
Copy Markdown
Member Author

anonrig commented Dec 30, 2025

@jasnell please take a look, i've addressed your review

@jasnell
Copy link
Copy Markdown
Collaborator

jasnell commented Feb 21, 2026

This needs to be rebased. Once it is I'll take another review pass

anonrig and others added 7 commits February 23, 2026 11:14
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
Co-authored-by: James M Snell <jsnell@cloudflare.com>
@anonrig anonrig force-pushed the yagiz/fix-cancel-wpt branch from f39c0c7 to 7f2cb8f Compare February 23, 2026 16:14
@anonrig anonrig requested a review from jasnell February 23, 2026 16:28
@codspeed-hq

This comment was marked as off-topic.

@anonrig anonrig merged commit 39de2c4 into main Feb 23, 2026
22 of 23 checks passed
@anonrig anonrig deleted the yagiz/fix-cancel-wpt branch February 23, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants