mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
LibJS: Change non-ScriptFunction source string to "[native code]"
https://tc39.es/ecma262/#sec-function.prototype.tostring - this is how the spec wants us to do it. :^) Also change the function name behaviour to only provide a name for NativeFunctions, which matches other engines - presumably to not expose Proxy objects, and to prevent "function bound foo() { [native code] }".
This commit is contained in:
parent
f9287fca1e
commit
202f855055
2 changed files with 13 additions and 6 deletions
|
@ -12,6 +12,6 @@ test("basic functionality", () => {
|
|||
return bar + 42;
|
||||
}.toString()
|
||||
).toBe("function (foo, bar, baz) {\n ???\n}");
|
||||
expect(console.debug.toString()).toBe("function debug() {\n [NativeFunction]\n}");
|
||||
expect(Function.toString()).toBe("function Function() {\n [FunctionConstructor]\n}");
|
||||
expect(console.debug.toString()).toBe("function debug() {\n [native code]\n}");
|
||||
expect(Function.toString()).toBe("function Function() {\n [native code]\n}");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue