1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

LibJS: Fix second argument passed to Proxy [[Call]] trap (thisArgument)

This commit is contained in:
Linus Groh 2021-07-06 15:30:19 +01:00
parent f15ad9523d
commit 30fe0529bd
2 changed files with 5 additions and 3 deletions

View file

@ -13,14 +13,15 @@ describe("[[Call]] trap normal behavior", () => {
const handler = {
apply(target, this_, arguments_) {
expect(target).toBe(f);
expect(this_).toBe(handler);
// FIXME: `this_` is currently `handler`
// expect(this_).toBeUndefined();
if (arguments_[2]) {
return arguments_[0] * arguments_[1];
}
return f(...arguments_);
},
};
p = new Proxy(f, handler);
let p = new Proxy(f, handler);
expect(p(2, 4)).toBe(6);
expect(p(2, 4, true)).toBe(8);