fix(ext/web): update ongoing promise in async iterator return() method (#23642)

See https://github.com/whatwg/webidl/pull/1387 for context.

There are new WPT tests for this change in
https://github.com/web-platform-tests/wpt/pull/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 commit is contained in:
Mattias Buelens 2024-05-14 01:34:25 +02:00 committed by GitHub
parent f2dc3f9a94
commit 9338770a70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 11 deletions

View file

@ -4964,11 +4964,11 @@ const readableStreamAsyncIteratorPrototype = ObjectSetPrototypeOf({
return PromiseResolve({ value: undefined, done: true });
};
const returnPromise = reader[_iteratorNext]
reader[_iteratorNext] = reader[_iteratorNext]
? PromisePrototypeThen(reader[_iteratorNext], returnSteps, returnSteps)
: returnSteps();
return PromisePrototypeThen(
returnPromise,
reader[_iteratorNext],
() => ({ value: arg, done: true }),
);
},