Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: dabbab2ba61ec615fba37cb099de201ff4be572c
https://github.com/WebKit/WebKit/commit/dabbab2ba61ec615fba37cb099de201ff4be572c
Author: Sosuke Suzuki <[email protected]>
Date: 2025-10-05 (Sun, 05 Oct 2025)
Changed paths:
M JSTests/stress/calling-non-callable-constructors.js
A JSTests/stress/constructor-call-without-new.js
M
JSTests/stress/constructor-kind-naked-should-not-be-applied-to-inner-functions.js
M JSTests/stress/promise-cannot-be-called.js
M LayoutTests/js/Promise-types-expected.txt
M LayoutTests/js/class-syntax-call-expected.txt
M LayoutTests/js/class-syntax-default-constructor-expected.txt
M LayoutTests/js/script-tests/Promise-types.js
M LayoutTests/js/script-tests/class-syntax-call.js
M LayoutTests/js/script-tests/class-syntax-default-constructor.js
M LayoutTests/performance-api/performance-observer-exception-expected.txt
M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Log Message:
-----------
[JSC] Improve error message for calling constructor without `new`
https://bugs.webkit.org/show_bug.cgi?id=298927
Reviewed by Yusuke Suzuki.
Calling constructors without `new` is invalid:
class Foo {}
Foo();
Current JSC throws a TypeError with the message "Cannot call a class
constructor without |new|" for such code.
This patch changes this error message to include the constructor name
for debugging experience.
Test: JSTests/stress/constructor-call-without-new.js
Test: JSTests/stress/constructor-call-without-new.js
* JSTests/stress/calling-non-callable-constructors.js:
(shouldThrow):
* JSTests/stress/constructor-call-without-new.js: Added.
(shouldThrow):
(throw.new.Error):
*
JSTests/stress/constructor-kind-naked-should-not-be-applied-to-inner-functions.js:
(shouldThrow.Promise):
* JSTests/stress/promise-cannot-be-called.js:
(shouldThrow):
* LayoutTests/js/Promise-types-expected.txt:
* LayoutTests/js/class-syntax-call-expected.txt:
* LayoutTests/js/class-syntax-default-constructor-expected.txt:
* LayoutTests/js/script-tests/Promise-types.js:
* LayoutTests/js/script-tests/class-syntax-call.js:
* LayoutTests/js/script-tests/class-syntax-default-constructor.js:
* LayoutTests/performance-api/performance-observer-exception-expected.txt:
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
Canonical link: https://commits.webkit.org/301023@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes