mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 01:56:38 +00:00
LibJS: Tweak FunctionPrototype::to_string and constructors
The output of FunctionPrototype::to_string is now more in line with the output in Firefox. The builtin constructors have been extended to include their function name in the output.
This commit is contained in:
parent
0d41e542b7
commit
bbd592cb6c
Notes:
sideshowbarker
2024-07-19 07:38:38 +09:00
Author: https://github.com/sunverwerth
Commit: bbd592cb6c
Pull-request: https://github.com/SerenityOS/serenity/pull/1774
13 changed files with 22 additions and 4 deletions
|
@ -10,8 +10,8 @@ try {
|
|||
}
|
||||
return bar + 42;
|
||||
}).toString() === "function (foo, bar, baz) {\n ???\n}");
|
||||
assert(console.log.toString() === "function () {\n [NativeFunction]\n}");
|
||||
assert(Function.toString() === "function () {\n [FunctionConstructor]\n}");
|
||||
assert(console.log.toString() === "function log() {\n [NativeFunction]\n}");
|
||||
assert(Function.toString() === "function Function() {\n [FunctionConstructor]\n}");
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
|
|
|
@ -41,7 +41,7 @@ try {
|
|||
new isNaN();
|
||||
} catch(e) {
|
||||
assert(e.name === "TypeError");
|
||||
assert(e.message === "function () {\n [NativeFunction]\n} is not a constructor");
|
||||
assert(e.message === "function isNaN() {\n [NativeFunction]\n} is not a constructor");
|
||||
}
|
||||
|
||||
console.log("PASS");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue