Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadableStreamBYOBReader read() throws when given DataView #40612

Closed
mrbbot opened this issue Oct 26, 2021 · 0 comments
Closed

ReadableStreamBYOBReader read() throws when given DataView #40612

mrbbot opened this issue Oct 26, 2021 · 0 comments
Labels
confirmed-bug Issues with confirmed bugs. web streams

Comments

@mrbbot
Copy link
Contributor

mrbbot commented Oct 26, 2021

Version

v17.0.1

Platform

Darwin MrBBots-MBP 19.6.0 Darwin Kernel Version 19.6.0: Thu May 6 00:48:39 PDT 2021; root:xnu-6153.141.33~1/RELEASE_X86_64 x86_64

Subsystem

stream

What steps will reproduce the bug?

Running node byob.mjs with:

// byob.mjs

import { ReadableStream } from "stream/web";

const stream = new ReadableStream({
  type: "bytes",
  start(controller) {
    controller.enqueue(new Uint8Array([1, 2, 3]));
    controller.close();
  },
});

const buffer = new ArrayBuffer(1024);
const reader = stream.getReader({ mode: "byob" });
const result = await reader.read(new DataView(buffer));
console.log(result);

...throws the following:

node:internal/webstreams/readablestream:1492
  return new ctor(transferredBuffer, byteOffset, bytesFilled / elementSize);
         ^

TypeError: ctor is not a constructor
    at readableByteStreamControllerConvertPullIntoDescriptor (node:internal/webstreams/readablestream:1492:10)
    at readableByteStreamControllerPullInto (node:internal/webstreams/readablestream:2145:9)
    at readableStreamBYOBReaderRead (node:internal/webstreams/readablestream:1717:3)
    at ReadableStreamBYOBReader.read (node:internal/webstreams/readablestream:881:5)
    at file:///.../byob.mjs:15:29
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)

Replacing new DataView with new Uint8Array returns the expected output:

{ value: Uint8Array(3) [ 1, 2, 3 ], done: false }

How often does it reproduce? Is there a required condition?

No required condition, throws every time

What is the expected behavior?

Running the code in the latest Chrome (without the import) produces the following expected output:

{ value: DataView(3), done: false }

What do you see instead?

See the stack trace above

Additional information

No response

@mrbbot mrbbot changed the title ReadableStreamBYOBReader throws when given DataView ReadableStreamBYOBReader read() throws when given DataView Oct 26, 2021
@iam-frankqiu iam-frankqiu added the stream Issues and PRs related to the stream subsystem. label Oct 26, 2021
@Mesteery Mesteery added web streams and removed stream Issues and PRs related to the stream subsystem. labels Oct 26, 2021
VoltrexKeyva added a commit to VoltrexKeyva/node that referenced this issue Oct 27, 2021
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: nodejs#40612
VoltrexKeyva added a commit to VoltrexKeyva/node that referenced this issue Oct 27, 2021
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: nodejs#40612
@VoltrexKeyva VoltrexKeyva added the confirmed-bug Issues with confirmed bugs. label Oct 27, 2021
VoltrexKeyva added a commit to VoltrexKeyva/node that referenced this issue Oct 27, 2021
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: nodejs#40612
aduh95 pushed a commit to aduh95/node that referenced this issue Oct 27, 2021
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: nodejs#40612
VoltrexKeyva added a commit to VoltrexKeyva/node that referenced this issue Nov 4, 2021
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: nodejs#40612
VoltrexKeyva added a commit to VoltrexKeyva/node that referenced this issue Nov 7, 2021
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: nodejs#40612
VoltrexKeyva added a commit to VoltrexKeyva/node that referenced this issue Nov 21, 2021
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: nodejs#40612
VoltrexKeyva added a commit to VoltrexKeyva/node that referenced this issue Jan 19, 2022
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: nodejs#40612
nodejs-github-bot pushed a commit that referenced this issue Jan 20, 2022
The WHATWG `ReadableStream` test needs a new test entry for reading a
`DataView`.

PR-URL: #40622
Fixes: #40612
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
BethGriggs pushed a commit that referenced this issue Jan 25, 2022
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: #40612

PR-URL: #40622
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
BethGriggs pushed a commit that referenced this issue Jan 25, 2022
The WHATWG `ReadableStream` test needs a new test entry for reading a
`DataView`.

PR-URL: #40622
Fixes: #40612
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Jan 31, 2022
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: nodejs#40612

PR-URL: nodejs#40622
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Jan 31, 2022
The WHATWG `ReadableStream` test needs a new test entry for reading a
`DataView`.

PR-URL: nodejs#40622
Fixes: nodejs#40612
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Feb 28, 2022
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: #40612

PR-URL: #40622
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Feb 28, 2022
The WHATWG `ReadableStream` test needs a new test entry for reading a
`DataView`.

PR-URL: #40622
Fixes: #40612
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Mar 2, 2022
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: #40612

PR-URL: #40622
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Mar 2, 2022
The WHATWG `ReadableStream` test needs a new test entry for reading a
`DataView`.

PR-URL: #40622
Fixes: #40612
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Mar 3, 2022
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: #40612

PR-URL: #40622
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Mar 3, 2022
The WHATWG `ReadableStream` test needs a new test entry for reading a
`DataView`.

PR-URL: #40622
Fixes: #40612
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Mar 14, 2022
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.

Fixes: #40612

PR-URL: #40622
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Mar 14, 2022
The WHATWG `ReadableStream` test needs a new test entry for reading a
`DataView`.

PR-URL: #40622
Fixes: #40612
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. web streams
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants