diff options
Diffstat (limited to 'js/src/jit-test/tests/basic/freeze-builtins.js')
-rw-r--r-- | js/src/jit-test/tests/basic/freeze-builtins.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/freeze-builtins.js b/js/src/jit-test/tests/basic/freeze-builtins.js new file mode 100644 index 0000000000..7f59c4b203 --- /dev/null +++ b/js/src/jit-test/tests/basic/freeze-builtins.js @@ -0,0 +1,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"); |