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

SUZUKI Sosuke noreply at github.com
Mon Feb 3 03:06:21 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 72c371adc8fe1744446197b6b816e538a83ef676
      https://github.com/WebKit/WebKit/commit/72c371adc8fe1744446197b6b816e538a83ef676
  Author: Sosuke Suzuki <aosukeke at gmail.com>
  Date:   2025-02-03 (Mon, 03 Feb 2025)

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

  Log Message:
  -----------
  [JSC] `AsyncFromSyncIterator` should close its sync-iterator when `throw` is null or undefined
https://bugs.webkit.org/show_bug.cgi?id=286885

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 first change.

[1]: https://github.com/tc39/ecma262/pull/2600
[2]: https://github.com/v8/v8/commit/6c3f7aa4c76af4c3e0c89c5c279f2b98867c35f0#diff-c18e5d5743326f6ba544801f6ce25154b785f759885651f98924d5b56dc1c2e6

* JSTests/stress/async-from-sync-iterator-prototype-throw-close-sync-iter.js: Added.
(shouldBe):
(shouldThrowAsync):
(throw.new.Error.const.syncIterator.get throw):
(throw.new.Error.const.asyncIterator):
(throw.new.Error.async OurError):
(throw.new.Error):
(const.syncIterator.get throw):
(throw.new.Error.async drainMicrotasks):
(const.asyncIterator):
(async OurError):
(OurError):
(NotOurError):
(const.syncIterator.get return):
(async drainMicrotasks):
(async asyncIterator):
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/builtins/AsyncFromSyncIteratorPrototype.js:
(throw):

Canonical link: https://commits.webkit.org/289726@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