Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e704581e3ddb17f63e6abb99e3984fc03d5c0771
https://github.com/WebKit/WebKit/commit/e704581e3ddb17f63e6abb99e3984fc03d5c0771
Author: Tetsuharu Ohzeki <[email protected]>
Date: 2026-04-21 (Tue, 21 Apr 2026)
Changed paths:
R JSTests/stress/promise-finally-should-accept-non-promise-objects.js
R JSTests/stress/promise-finally.js
A JSTests/stress/promise-prototype-finally-bug-312466.js
A
JSTests/stress/promise-prototype-finally-should-accept-non-promise-objects.js
A JSTests/stress/promise-prototype-finally.js
M Source/JavaScriptCore/runtime/JSPromisePrototype.cpp
Log Message:
-----------
[JSC] Promise.prototype.finally should throw in `SpeciesConstructor(promise,
%Promise%)` abstract step properly before invoking `promise.then`
https://bugs.webkit.org/show_bug.cgi?id=312466
Reviewed by Yusuke Suzuki.
This fix the regression since https://commits.webkit.org/305248@main.
---
By ECMA-262 (April 10, 2026),
_27.2.5.3 Promise.prototype.finally_ checks and raises the error
if the |this|'s species constructor is not a constructor in its step 3 which
invokes _7.3.22 SpeciesConstructor_.
- https://tc39.es/ecma262/#sec-promise.prototype.finally
- https://tc39.es/ecma262/#sec-speciesconstructor
I seem this case is covered by [test262][test262]
and it was imported to WebKit repo by https://commits.webkit.org/308596@main.
But the test262's test does not check the detail of `TypeError`.
Its TypeError is caused by that mimic |this| lacks |then|.
[test262]:
https://github.com/tc39/test262/blob/1775ee48c9d71fbd1ec6a1a66ac23efcbd627f8f/test/built-ins/Promise/prototype/finally/species-construc
tor-throws.js
Tests: JSTests/stress/promise-prototype-finally-bug-312466.js
JSTests/stress/promise-prototype-finally-should-accept-non-promise-objects.js
JSTests/stress/promise-prototype-finally.js
* JSTests/stress/promise-prototype-finally-bug-312466.js: Added.
This is test for this change.
* JSTests/stress/promise-prototype-finally-should-accept-non-promise-objects.js
Rename the file to match the test's target function.
* JSTests/stress/promise-prototype-finally.js
Rename the file to match the test's target function.
* Source/JavaScriptCore/runtime/JSPromisePrototype.cpp:
To avoid to call `promiseSpeciesConstructor()` even if |this| is
`JSPromise`,
this patch split a slow path for the other case.
Canonical link: https://commits.webkit.org/311725@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications