mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
35 lines
804 B
JavaScript
35 lines
804 B
JavaScript
|
|
test("Accessor removal during getter execution should bust GetById cache", () => {
|
||
|
|
function f(obj, expected) {
|
||
|
|
expect(obj.hm).toBe(expected);
|
||
|
|
}
|
||
|
|
|
||
|
|
const proto = {
|
||
|
|
get hm() {
|
||
|
|
delete proto.hm;
|
||
|
|
return 123;
|
||
|
|
},
|
||
|
|
};
|
||
|
|
const obj = Object.create(proto);
|
||
|
|
|
||
|
|
f(obj, 123);
|
||
|
|
f(obj, undefined);
|
||
|
|
});
|
||
|
|
|
||
|
|
test("Overriding an inherited getter with a data property on an intermediate prototype invalidates prototype-chain cache", () => {
|
||
|
|
function f(obj, expected) {
|
||
|
|
expect(obj.hm).toBe(expected);
|
||
|
|
}
|
||
|
|
|
||
|
|
const proto = {};
|
||
|
|
proto.__proto__ = {
|
||
|
|
get hm() {
|
||
|
|
return 123;
|
||
|
|
},
|
||
|
|
};
|
||
|
|
const obj = Object.create(proto);
|
||
|
|
|
||
|
|
f(obj, 123);
|
||
|
|
Object.defineProperty(proto, "hm", { value: 321 });
|
||
|
|
f(obj, 321);
|
||
|
|
});
|