Repository navigation
Conversation
…tream
`isDisturbed`, `isErrored` and `isReadable` from `node:stream` read
`Symbol.for("nodejs.stream.{disturbed,errored,readable}")` from the
stream. Node's web ReadableStream defines getters for these keys, but
Deno's did not, so the helpers ignored the state of a web stream.
Fixes denoland#37150
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #37150
isDisturbed/Readable.isDisturbed,isErroredandisReadablefromnode:streamreadSymbol.for("nodejs.stream.disturbed"),"nodejs.stream.errored"and"nodejs.stream.readable"from the stream (ext/node/polyfills/internal/streams/utils.js). Node's webReadableStreamdefines getters for these keys (lib/internal/webstreams/readablestream.js), but Deno's didn't, so for a web stream the helpers returnedfalse,falseandnullwhatever its state.This adds the three getters to
ReadableStreaminext/web/06_streams.js, reading the state the stream already tracks:disturbed→[_disturbed]errored→[_state] === "errored"readable→[_state] === "readable"These match Node's definitions. The keys are symbols, so
webidl.configureInterfaceleaves them non-enumerable.With the issue's repro, the output now matches Node.js:
Tests
Added
isDisturbed, isErrored and isReadable on web streamstotests/unit_node/stream_test.ts. It covers a fresh stream, a stream after a read, an errored stream and a cancelled stream.AI disclosure
I used an AI assistant (Claude) to help investigate the issue and draft this change. I reviewed and tested it.