workerd icon indicating copy to clipboard operation
workerd copied to clipboard

fix streams byob request handling after close for spec compliance

Open anonrig opened this issue 2 months ago • 1 comments

Fix ReadableByteStreamController to properly handle byob requests after close(), making respondWithNewView() throw correct errors per the WHATWG Streams spec.

Removed premature byob request invalidation because spec required byob requests to remain accessible after close so that respondWithNewView throw correct errors. Had to store original buffer byte length and byte offset as well in order to make it available for validation even after the underlying ByobRequest is invalidated during close.

Had to update several test contexts due to invalid configuration.

Fixes WPT readable-byte-streams/bad-buffers-and-views.any.js

anonrig avatar Dec 24 '25 18:12 anonrig

I might merge this into the state-machine update for this class. Please do not merge this yet.

jasnell avatar Dec 24 '25 18:12 jasnell