node
node copied to clipboard
Update ongoing promise in async iterator `return()` method
There's an edge case with the current Web IDL bindings for async iterators where manually calling return(); next()
could result in the next()
promise resolving before the return()
promise. The latest version of the Web IDL specification fixes this by updating the "ongoing promise" in the async iterator return()
method.
For Node.js, this affects ReadableStream.prototype[Symbol.asyncIterator]
. More specifically, this part needs to be changed: https://github.com/nodejs/node/blob/a8de25ed1523594dd6bf0ee08a24f146d38cb4e8/lib/internal/webstreams/readablestream.js#L547-L554
- Web IDL spec change
-
Web platform tests (for
ReadableStream[@@asyncIterator]
)
/cc @nodejs/whatwg-stream
Good finding! Are you planning to send a PR to fix?
@mcollina Sure, I can do that. I'll wait for the spec change to land first.