mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibJS: Don't coerce this value to an object in Function.prototype.call
This commit is contained in:
parent
12231068bd
commit
1bfbc0b6af
Notes:
sideshowbarker
2024-07-17 19:04:51 +09:00
Author: https://github.com/Lubrsi
Commit: 1bfbc0b6af
Pull-request: https://github.com/SerenityOS/serenity/pull/12404
Reviewed-by: https://github.com/linusg ✅
2 changed files with 29 additions and 4 deletions
|
@ -51,3 +51,19 @@ test("basic functionality", () => {
|
|||
|
||||
expect((() => this).call("foo")).toBe(globalThis);
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("does not accept non-function values", () => {
|
||||
expect(() => {
|
||||
Function.prototype.call.call("foo");
|
||||
}).toThrowWithMessage(TypeError, "foo is not a function");
|
||||
|
||||
expect(() => {
|
||||
Function.prototype.call.call(undefined);
|
||||
}).toThrowWithMessage(TypeError, "undefined is not a function");
|
||||
|
||||
expect(() => {
|
||||
Function.prototype.call.call(null);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue