Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 72b5e3201731dca82dadaf20938a9c83295fa07d
https://github.com/WebKit/WebKit/commit/72b5e3201731dca82dadaf20938a9c83295fa07d
Author: Sosuke Suzuki <[email protected]>
Date: 2025-12-04 (Thu, 04 Dec 2025)
Changed paths:
A JSTests/microbenchmarks/promise-race.js
M JSTests/stress/new-promise-capabilities-requires-constructor.js
A JSTests/stress/promise-race-empty-args.js
A JSTests/stress/promise-race-fast-path-not-thenable.js
A JSTests/stress/promise-race-multiple-resolved.js
A JSTests/stress/promise-race-slow-path-non-thenable.js
A JSTests/stress/promsie-race-resolve-getter-throws.js
M Source/JavaScriptCore/builtins/PromiseConstructor.js
M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
M Source/JavaScriptCore/runtime/JSGlobalObject.h
M Source/JavaScriptCore/runtime/JSMicrotask.cpp
M Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
Log Message:
-----------
[JSC] Implement `Promise.race` in C++
https://bugs.webkit.org/show_bug.cgi?id=300569
Reviewed by Yusuke Suzuki.
This reverts commit 303121@main to reland 303034@main.
PromiseFirstResolveWithoutHandlerJob was calling resolvePromise directly,
which could trigger createResolvingFunctions for thenable values and bypass
the first-resolve guard, leading to assertion failure when the same promise
was resolved/rejected multiple times.
So this new patch changes to make PromiseFirstResolveWithoutHandlerJob use
`JSPromise::resolve` and `JSPromise::reject` instead of
`JSPromise::resolvePromise`
and `JSPromise::rejectPromise`.
------
This patch changes to implement `Promise.race` in C++.
* JSTests/microbenchmarks/promise-race.js: Added.
* JSTests/stress/new-promise-capabilities-requires-constructor.js:
(shouldThrow):
* JSTests/stress/promise-race-empty-args.js: Added.
(shouldBe):
* JSTests/stress/promise-race-fast-path-not-thenable.js: Added.
(shouldThrowAsync):
(shouldThrowAsync.async var):
* JSTests/stress/promise-race-multiple-resolved.js: Added.
* JSTests/stress/promise-race-slow-path-non-thenable.js: Added.
(shouldThrowAsync):
(shouldThrowAsync.async const):
(shouldThrowAsync.Promise.resolve):
* JSTests/stress/promsie-race-resolve-getter-throws.js: Added.
(shouldBe):
* Source/JavaScriptCore/builtins/PromiseConstructor.js:
(any):
(race): Deleted.
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::promiseResolveWatchpointSet):
* Source/JavaScriptCore/runtime/JSMicrotask.cpp:
(JSC::runInternalMicrotask):
* Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp:
(JSC::isFastPromiseConstructor):
(JSC::promiseRaceSlow):
(JSC::JSC_DEFINE_HOST_FUNCTION):
Canonical link: https://commits.webkit.org/303893@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications