Update ongoing promise in async iterator return() method#1387
Merged
domenic merged 1 commit intowhatwg:mainfrom Feb 13, 2024
Merged
Conversation
domenic
approved these changes
Feb 9, 2024
Member
domenic
left a comment
There was a problem hiding this comment.
LGTM! I think this is a bugfix and I hope someone from WebKit and/or Mozilla can quickly step up to approve. I take it that it has Chromium support already.
annevk
approved these changes
Feb 9, 2024
Member
annevk
left a comment
There was a problem hiding this comment.
Makes sense that they should be aligned. Please file implementation bugs.
This was referenced Feb 11, 2024
domenic
pushed a commit
to whatwg/streams
that referenced
this pull request
Apr 24, 2024
Notably, this includes tests for promise resolution order of async iterators in the reference implementation. This requires updating webidl2js. See whatwg/webidl#1387, web-platform-tests/wpt#44456, and jsdom/webidl2js#269 for context.
bartlomieju
pushed a commit
to denoland/deno
that referenced
this pull request
May 13, 2024
…hod (#23642) See whatwg/webidl#1387 for context. There are new WPT tests for this change in web-platform-tests/wpt#44456. They pass on my local machine, but I'm not sure if I should update the WPT submodule for all of Deno as part of this PR? Fixes #22389 --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.
bartlomieju
pushed a commit
to denoland/deno
that referenced
this pull request
May 16, 2024
…hod (#23642) See whatwg/webidl#1387 for context. There are new WPT tests for this change in web-platform-tests/wpt#44456. They pass on my local machine, but I'm not sure if I should update the WPT submodule for all of Deno as part of this PR? Fixes #22389 --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@yuki3 found an interesting edge case related to async iterators.
In Firefox and Node.js (where async iteration on
ReadableStreamis already supported), when you run this snippet:you get:
This is quite surprising: the second
next()promise resolves before thereturn()promise, even though it was called afterreturn(). Intuitively, we would expect all async iterator calls to get queued. Indeed, if you do the same thing with an async generator:then the promises resolve in the order of the original calls:
Yuki and I believe this to be a bug in the Web IDL specification. More precisely, the
return()method should update the ongoing promise, such that future calls tonext()andreturn()are properly chained. This aligns more closely with the behavior of async generators.Suggested commit message:
ReadableStream.prototype[Symbol.asyncIterator], which WebKit doesn't support yet. (https://bugs.webkit.org/show_bug.cgi?id=194379)return()method denoland/deno#22389return()method nodejs/node#51725(See WHATWG Working Mode: Changes for more details.)
Preview | Diff