Skip to content

Commit f10d9ad

Browse files
jazellymarco-ippolito
authored andcommitted
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: #55119 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Mattias Buelens <[email protected]>
1 parent 81bcec0 commit f10d9ad

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

lib/internal/webstreams/util.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,12 @@ function createAsyncFromSyncIterator(syncIteratorRecord) {
230230
return { iterator: asyncIterator, nextMethod, done: false };
231231
}
232232

233+
// Refs: https://tc39.es/ecma262/#sec-getiterator
233234
function getIterator(obj, kind = 'sync', method) {
234235
if (method === undefined) {
235236
if (kind === 'async') {
236237
method = obj[SymbolAsyncIterator];
237-
if (method === undefined) {
238+
if (method == null) {
238239
const syncMethod = obj[SymbolIterator];
239240

240241
if (syncMethod === undefined) {

test/wpt/status/streams.json

-7
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@
1616
"readable-streams/cross-realm-crash.window.js": {
1717
"skip": "Browser-specific test"
1818
},
19-
"readable-streams/from.any.js": {
20-
"fail": {
21-
"expected": [
22-
"ReadableStream.from ignores a null @@asyncIterator"
23-
]
24-
}
25-
},
2619
"readable-streams/owning-type-message-port.any.js": {
2720
"fail": {
2821
"note": "Readable streams with type owning are not yet supported",

0 commit comments

Comments
 (0)