node icon indicating copy to clipboard operation
node copied to clipboard

Web Streams: reject pending reads when releasing reader

Open MattiasBuelens opened this issue 2 years ago • 7 comments

Previously, calling ReadableStreamDefaultReader.releaseLock() or ReadableStreamBYOBReader.releaseLock() while there are pending read() requests would throw a TypeError.

The specification has been changed to allow this case, and to reject such pending read() requests instead.

Standard change: https://github.com/whatwg/streams/pull/1168 Tests: https://github.com/web-platform-tests/wpt/pull/32072

MattiasBuelens avatar Jan 13 '22 22:01 MattiasBuelens

@jasnell

ronag avatar Jan 14 '22 08:01 ronag

Hello. Every time I run reader.releaseLock(), an error is generated at any time, even on a newly created stream TypeError [ERR_INVALID_STATE]: Invalid state: Reader released

essential-existence avatar Feb 04 '22 16:02 essential-existence

@essential-existence I suggest you open a separate issue for that. This issue is about implementing a change to releaseLock().

That said, I am a bit curious. That error appears as the rejection reason for reader.closed, but that promise is always marked as handled so it shouldn't cause an unhandled rejection. Unless your code is doing something else with reader.closed, perhaps? I recommend you add some example code when opening a new issue. 😉

MattiasBuelens avatar Feb 04 '22 17:02 MattiasBuelens

Great to see this change landed in the spec! Definitely will be nice to get this behavior implemented.

jasnell avatar Feb 04 '22 17:02 jasnell

@essential-existence I suggest you open a separate issue for that. This issue is about implementing a change to releaseLock().

That said, I am a bit curious. That error appears as the rejection reason for reader.closed, but that promise is always marked as handled so it shouldn't cause an unhandled rejection. Unless your code is doing something else with reader.closed, perhaps? I recommend you add some example code when opening a new issue. 😉

Yes, indeed, without affecting closed no error is generated. I opened an issue.

essential-existence avatar Feb 05 '22 12:02 essential-existence

There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

For more information on how the project manages feature requests, please consult the feature request management document.

github-actions[bot] avatar Aug 05 '22 01:08 github-actions[bot]

Thank you auto-close bot bit I think this one needs to stay open for a bit still (unless it has already been resolved?)

jasnell avatar Aug 05 '22 13:08 jasnell

There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

For more information on how the project manages feature requests, please consult the feature request management document.

github-actions[bot] avatar Feb 02 '23 01:02 github-actions[bot]

@jasnell Looks like this was already fixed in #44292. 🙂

MattiasBuelens avatar Feb 02 '23 09:02 MattiasBuelens