Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6309e93f81935cb0fc885f371879cb35fd2c00df
https://github.com/WebKit/WebKit/commit/6309e93f81935cb0fc885f371879cb35fd2c00df
Author: Sosuke Suzuki <[email protected]>
Date: 2026-03-09 (Mon, 09 Mar 2026)
Changed paths:
A JSTests/stress/promise-resolve-subclass-should-not-return-base-promise.js
M Source/JavaScriptCore/runtime/JSPromise.cpp
Log Message:
-----------
[JSC] `Promise.resolve` with subclass constructor should not return base
Promise
https://bugs.webkit.org/show_bug.cgi?id=309472
Reviewed by Yusuke Suzuki.
The fast path in JSPromise::promiseResolve returned the argument
promise when the species watchpoint was valid, without checking that
the passed constructor C is the same as the argument's constructor.
This caused DerivedPromise.resolve(plainPromise) to return the plain
promise instead of creating a new DerivedPromise, violating
PromiseResolve step 1.b (SameValue(xConstructor, C))[1].
[1]: https://tc39.es/ecma262/#sec-promise-resolve
Test: JSTests/stress/promise-resolve-subclass-should-not-return-base-promise.js
* JSTests/stress/promise-resolve-subclass-should-not-return-base-promise.js:
Added.
(shouldBe):
(DerivedPromise):
(result.then):
(shouldBe.MyThenable):
* Source/JavaScriptCore/runtime/JSPromise.cpp:
(JSC::JSPromise::promiseResolve):
Canonical link: https://commits.webkit.org/308899@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications