LibJS: Preserve the original this value

As shown in the test added by this patch, it was possible to re-assign
the `this` value of a member function call while it was executing.
Let's copy the original this value like we already do with the callee.

Fixes #2226.
This commit is contained in:
Jonne Ransijn 2024-11-08 17:59:12 +01:00 committed by Andreas Kling
parent f4124c7f40
commit e53e1d3586
Notes: github-actions[bot] 2024-11-08 18:17:48 +00:00
2 changed files with 15 additions and 8 deletions

View file

@ -0,0 +1,5 @@
test("overwriting this during function call still binds the original", () => {
let tmp = new Map();
// prettier-ignore
tmp.set("", tmp = []);
});