mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:37:35 +00:00
LibJS/Bytecode: Check if eval function is a function
When overriding 'eval' to a non-function value, the interpreter would crash. Now it handles this case swiftly, throwing a TypeError.
This commit is contained in:
parent
a9ef65e64a
commit
1850652881
2 changed files with 7 additions and 1 deletions
|
@ -13,3 +13,8 @@ test("variable named 'eval' pointing to real eval works as a direct eval", funct
|
|||
var eval = globalThis.eval;
|
||||
expect(eval("testValue")).toEqual("inner");
|
||||
});
|
||||
|
||||
test("variable named 'eval' pointing to a non-function raises a TypeError", function () {
|
||||
var eval = "borked";
|
||||
expect(() => eval("something").toThrowWithMessage(TypeError, "borked is not a function"));
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue