blob: 7f59c4b203c61987b1ad26a83d668f64e7300c70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
var g = newGlobal({freezeBuiltins: true});
g.evaluate("" + function checkFrozen(name) {
// Check constructor on the global is non-writable/non-configurable.
let desc = Object.getOwnPropertyDescriptor(this, name);
assertEq(desc.writable, false);
assertEq(desc.configurable, false);
// Constructor must be frozen.
let ctor = desc.value;
assertEq(Object.isFrozen(ctor), true);
// Prototype must be sealed.
if (ctor.prototype) {
assertEq(Object.isSealed(ctor.prototype), true);
}
});
g.checkFrozen("Object");
g.checkFrozen("Array");
g.checkFrozen("Function");
|