test("Modifying prototype in dictionary mode should cause prototype-chain validity invalidation (dict-mode prototype is in the middle of prototype chain)",()=>{
functionf(obj,expected){
expect(obj.hm).toBe(expected);
}
constmidProto={};
midProto.__proto__={
gethm(){
return321;
},
};
constproto={};
proto.__proto__=midProto;
constobj=Object.create(proto);
// put midProto into dictionary mode
for(leti=0;i<1000;i++){
midProto["i"+i]=i;
}
f(obj,321);
Object.defineProperty(midProto,"hm",{
get(){
return123;
},
configurable:true,
});
f(obj,123);
});
test("Modifying prototype in dictionary mode should cause prototype-chain validity invalidation (dict-mode prototype is direct prototype of target object)",()=>{