summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/testSetImmutablePrototype.js
blob: bc61dbbfcfdfb4f1354233394a6a793439c55f06 (plain)
1
2
3
4
5
6
7
8
9
10
11
load(libdir + "asserts.js");

let p = {};
let x = new Proxy({__proto__: p}, {});
assertEq(Reflect.getPrototypeOf(x), p);
setImmutablePrototype(x);
assertEq(Reflect.getPrototypeOf(x), p);
assertEq(Reflect.setPrototypeOf(x, Date.prototype), false);
assertEq(Reflect.setPrototypeOf(x, p), true);
assertThrowsInstanceOf(() => Object.setPrototypeOf(x, Date.prototype), TypeError);
assertEq(Reflect.getPrototypeOf(x), p);