[webkit-changes] [WebKit/WebKit] 1962d5: [JSC] `AsyncFromSyncIterator` should close its syn...

SUZUKI Sosuke noreply at github.com
Sun Feb 9 18:28:34 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1962d559593056e23a400faada02e62c7222c79e
      https://github.com/WebKit/WebKit/commit/1962d559593056e23a400faada02e62c7222c79e
  Author: Sosuke Suzuki <aosukeke at gmail.com>
  Date:   2025-02-09 (Sun, 09 Feb 2025)

  Changed paths:
    A JSTests/stress/async-from-sync-iterator-prototype-next-rejected-close-sync-iter.js
    A JSTests/stress/async-from-sync-iterator-prototype-throw-rejected-close-sync-iter.js
    M JSTests/test262/expectations.yaml
    M Source/JavaScriptCore/builtins/AsyncFromSyncIteratorPrototype.js
    M Source/JavaScriptCore/builtins/BuiltinNames.h

  Log Message:
  -----------
  [JSC] `AsyncFromSyncIterator` should close its sync-iterator when `next`/`throw` yields rejected promise
https://bugs.webkit.org/show_bug.cgi?id=273768

Reviewed by Yusuke Suzuki.

The normative change for `AsyncFromSyncIterator`[1] includes the following two changes:

1. AsyncFromSyncIterator now closes the sync iterator when `throw` is called on the
wrapper but is not implemented on the sync iterator. In that case, it updates the
rejection value to a `TypeError` to reflect the contract violation.
2. AsyncFromSyncIterator closes its sync iterator when the sync iterator yields a
rejected promise as its value.

This normative change has already been implemented in V8[2]. This patch changes to
implement only the second change.

[1]: tc39/ecma262#2600
[2]: v8/v8 at 6c3f7aa#diff-c18e5d5743326f6ba544801f6ce25154b785f759885651f98924d5b56dc1c2e6

* JSTests/stress/async-from-sync-iterator-prototype-next-rejected-close-sync-iter.js: Added.
(shouldBe):
(shouldThrowAsync):
(throw.new.Error.OurError):
(throw.new.Error.iterator):
(OurError):
(throw.new.Error.async drainMicrotasks):
(iterator):
(async asyncIterator):
(async drainMicrotasks):
* JSTests/stress/async-from-sync-iterator-prototype-throw-rejected-close-sync-iter.js: Added.
(shouldBe):
(shouldThrowAsync):
(throw.new.Error.OurError):
(throw.new.Error.async asyncIterator):
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/builtins/AsyncFromSyncIteratorPrototype.js:
(linkTimeConstant.asyncFromSyncIteratorOnRejected):
(linkTimeConstant.asyncFromSyncIteratorOnFulfilledContinue):
(linkTimeConstant.asyncFromSyncIteratorOnFulfilledDone):
(return):
(throw):
* Source/JavaScriptCore/builtins/BuiltinNames.h:

Canonical link: https://commits.webkit.org/290137@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list