-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
ReadableStream.from({})
returns confusing error
#53819
Comments
Note there is another apparent bug here. For some reason, const iterator = FunctionPrototypeCall(method, obj); Edit: reported issue in V8 https://issues.chromium.org/issues/352528966 |
The way I see it, the error message content displayed is a V8 bug, but the fact that it even got to that error (and not a validation error) may be an issue with Node.js. |
Had a quick look, I think something like this would prevent it: diff --git a/lib/internal/webstreams/util.js b/lib/internal/webstreams/util.js
index cce67d5b04..2b043f987c 100644
--- a/lib/internal/webstreams/util.js
+++ b/lib/internal/webstreams/util.js
@@ -243,6 +243,10 @@ function getIterator(obj, kind = 'sync', method) {
}
}
+ if (method === undefined) {
+ throw new ERR_INVALID_STATE.TypeError('The object is not iterable');
+ }
+
const iterator = FunctionPrototypeCall(method, obj); @debadree25 any idea? |
I believe that method is a 1-1 mapping of https://tc39.es/ecma262/#sec-getiterator and we are missing Step 1.b.ii and Step 3. so i think you diff should solve it @jakecastelli |
Thanks! I am not too familiar with webstream and wpt (roughly know the idea) do we need to add a test for this in our test/parallel or should this test be ideally in wpt upstream. |
I think test/parallel should be fine |
It seems to have started from |
Version
v22.4.1
Platform
Subsystem
No response
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
It should show a more descriptive error message. Maybe "value is not iterable".
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: