mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibJS: Make the Function() constructor throw a SyntaxError, not return
This commit is contained in:
parent
aab998e776
commit
7b8765c311
Notes:
sideshowbarker
2024-07-19 06:41:17 +09:00
Author: https://github.com/linusg
Commit: 7b8765c311
Pull-request: https://github.com/SerenityOS/serenity/pull/2209
2 changed files with 8 additions and 1 deletions
|
@ -26,6 +26,12 @@ try {
|
|||
assert(new Function().name === "anonymous");
|
||||
assert(new Function().toString() === "function anonymous() {\n ???\n}");
|
||||
|
||||
assertThrowsError(() => {
|
||||
new Function("[");
|
||||
}, {
|
||||
error: SyntaxError
|
||||
});
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e.message);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue