Skip to content

Commit

Permalink
stream: rename unknown primordial
Browse files Browse the repository at this point in the history
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: #40612
  • Loading branch information
VoltrexKeyva authored and aduh95 committed Oct 27, 2021
1 parent 6df7070 commit 1e1822b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/webstreams/readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {
ArrayBufferPrototypeSlice,
ArrayPrototypePush,
ArrayPrototypeShift,
DataViewCtor,
DataView,
FunctionPrototypeBind,
FunctionPrototypeCall,
MathMin,
Expand Down Expand Up @@ -2100,7 +2100,7 @@ function readableByteStreamControllerPullInto(
pendingPullIntos,
} = controller[kState];
let elementSize = 1;
let ctor = DataViewCtor;
let ctor = DataView;
if (isArrayBufferView(view) && !isDataView(view)) {
elementSize = view.constructor.BYTES_PER_ELEMENT;
ctor = view.constructor;
Expand Down
15 changes: 15 additions & 0 deletions test/parallel/test-whatwg-readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -1570,3 +1570,18 @@ class Source {
isDisturbed(stream, true);
})().then(common.mustCall());
}

{
const stream = new ReadableStream({
type: 'bytes',
start(controller) {
controller.close();
}
});

const buffer = new ArrayBuffer(1024);
const reader = stream.getReader({ mode: 'byob' });

reader.read(new DataView(buffer))
.then(common.mustCall());
}

0 comments on commit 1e1822b

Please sign in to comment.