1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

LibJS: Forward receiver value to native property getters/setters

There's no reason why only (user-defined) accessors would have set the
receiver as this value for their getters/setters, this is an oversight.
This commit is contained in:
Linus Groh 2020-11-22 17:29:25 +00:00 committed by Andreas Kling
parent c52739ea4b
commit 48369194d2
4 changed files with 32 additions and 18 deletions

View file

@ -93,4 +93,10 @@ describe("normal behavior", () => {
expect(foo.setPropCalled).toBeTrue();
expect(bar.setPropCalled).toBeTrue();
});
test("native setter function", () => {
const e = new Error();
Reflect.set(Error.prototype, "name", "Foo", e);
expect(e.name).toBe("Foo");
});
});