Skip to content

Commit

Permalink
stream: fix the ReadableStreamBYOBReader error message
Browse files Browse the repository at this point in the history
PR-URL: #40846
Reviewed-By: Robert Nagy <ronagy@icloud.com>
  • Loading branch information
jasnell authored and danielleadams committed Feb 1, 2022
1 parent a905dfe commit 9811617
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/internal/webstreams/readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@ class ReadableStream {
return customInspect(depth, options, this[kType], {
locked: this.locked,
state: this[kState].state,
supportsBYOB:
this[kState].controller instanceof ReadableByteStreamController,
});
}

Expand Down Expand Up @@ -1745,7 +1747,7 @@ function setupReadableStreamBYOBReader(reader, stream) {
controller,
} = stream[kState];
if (!isReadableByteStreamController(controller))
throw new ERR_INVALID_ARG_VALUE('reader', reader, 'must be a byte stream');
throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be a byte stream');
readableStreamReaderGenericInitialize(reader, stream);
reader[kState].readIntoRequests = [];
}
Expand Down
6 changes: 4 additions & 2 deletions test/parallel/test-whatwg-readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -1410,10 +1410,12 @@ class Source {

assert.strictEqual(
inspect(readable),
'ReadableStream { locked: false, state: \'readable\' }');
'ReadableStream { locked: false, state: \'readable\', ' +
'supportsBYOB: false }');
assert.strictEqual(
inspect(readable, { depth: null }),
'ReadableStream { locked: false, state: \'readable\' }');
'ReadableStream { locked: false, state: \'readable\', ' +
'supportsBYOB: false }');
assert.strictEqual(
inspect(readable, { depth: 0 }),
'ReadableStream [Object]');
Expand Down

0 comments on commit 9811617

Please sign in to comment.