mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
stream: treat null asyncIterator as undefined
According to the spec, getIterator should normalize incoming method to undefined if it is either undefined or null. This PR enforces that spec compliance with passed WPT. PR-URL: https://github.com/nodejs/node/pull/55119 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com>
This commit is contained in:
parent
fb852798dc
commit
87a79cd8a1
@ -211,11 +211,12 @@ function createAsyncFromSyncIterator(syncIteratorRecord) {
|
||||
return { iterator: asyncIterator, nextMethod, done: false };
|
||||
}
|
||||
|
||||
// Refs: https://tc39.es/ecma262/#sec-getiterator
|
||||
function getIterator(obj, kind = 'sync', method) {
|
||||
if (method === undefined) {
|
||||
if (kind === 'async') {
|
||||
method = obj[SymbolAsyncIterator];
|
||||
if (method === undefined) {
|
||||
if (method == null) {
|
||||
const syncMethod = obj[SymbolIterator];
|
||||
|
||||
if (syncMethod === undefined) {
|
||||
|
@ -16,13 +16,6 @@
|
||||
"readable-streams/cross-realm-crash.window.js": {
|
||||
"skip": "Browser-specific test"
|
||||
},
|
||||
"readable-streams/from.any.js": {
|
||||
"fail": {
|
||||
"expected": [
|
||||
"ReadableStream.from ignores a null @@asyncIterator"
|
||||
]
|
||||
}
|
||||
},
|
||||
"readable-streams/owning-type-message-port.any.js": {
|
||||
"fail": {
|
||||
"note": "Readable streams with type owning are not yet supported",
|
||||
|
Loading…
Reference in New Issue
Block a user