Skip to content
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

Update ongoing promise in async iterator return() method #22389

Closed
MattiasBuelens opened this issue Feb 11, 2024 · 0 comments · Fixed by #23642
Closed

Update ongoing promise in async iterator return() method #22389

MattiasBuelens opened this issue Feb 11, 2024 · 0 comments · Fixed by #23642

Comments

@MattiasBuelens
Copy link
Contributor

MattiasBuelens commented Feb 11, 2024

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 Deno, this affects ReadableStream.prototype[Symbol.asyncIterator]. More specifically, this part needs to be changed:

deno/ext/web/06_streams.js

Lines 4963 to 4969 in 26d9b2f

const returnPromise = reader[_iteratorNext]
? PromisePrototypeThen(reader[_iteratorNext], returnSteps, returnSteps)
: returnSteps();
return PromisePrototypeThen(
returnPromise,
() => ({ value: arg, done: true }),
);

bartlomieju pushed a commit that referenced this issue 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 that referenced this issue 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant