Skip to content

Call IteratorClose if js_promise_resolve throws in js_async_from_sync_iterator_next - #1742

Closed
goffrie wants to merge 1 commit into
quickjs-ng:masterfrom
goffrie:close-iterator-if-promise-resolve-throws
Closed

goffrie wants to merge 1 commit into
quickjs-ng:masterfrom
goffrie:close-iterator-if-promise-resolve-throws

Conversation

@goffrie

@goffrie goffrie commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

As specified in https://tc39.es/ecma262/#sec-asyncfromsynciteratorcontinuation:

  1. Let valueWrapper be Completion(PromiseResolve(%Promise%, value)).
  2. If valueWrapper is an abrupt completion, done is false, and closeOnRejection is true, then
    7a. Set valueWrapper to Completion(IteratorClose(syncIteratorRecord, valueWrapper)).

closeOnRejection is true for %AsyncFromSyncIteratorPrototype%.next and .throw, i.e. magic != GEN_MAGIC_RETURN.

This fixes a few test262 cases.

Disclosure: this PR was created with LLM assistance, but all text is my own.

@goffrie

goffrie commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Actually this is obviated by #1743, bellard quickjs already fixed this and a host of other issues.

@goffrie goffrie closed this Sep 23, 2026
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 this pull request may close these issues.

1 participant