diff --git a/lib/internal/webstreams/readablestream.js b/lib/internal/webstreams/readablestream.js index e661fc23894024..bb1bbf947b4e0b 100644 --- a/lib/internal/webstreams/readablestream.js +++ b/lib/internal/webstreams/readablestream.js @@ -7,7 +7,7 @@ const { ArrayBufferPrototypeSlice, ArrayPrototypePush, ArrayPrototypeShift, - DataViewCtor, + DataView, FunctionPrototypeBind, FunctionPrototypeCall, MathMin, @@ -2132,7 +2132,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; diff --git a/test/parallel/test-whatwg-readablestream.js b/test/parallel/test-whatwg-readablestream.js index d27abdc75cea03..13261fe6b7ca84 100644 --- a/test/parallel/test-whatwg-readablestream.js +++ b/test/parallel/test-whatwg-readablestream.js @@ -1602,3 +1602,18 @@ class Source { isReadable(stream, false); })().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()); +}