28 lines
650 B
Plaintext
28 lines
650 B
Plaintext
js> load('testsrc/doctests/util.js');
|
|
|
|
js> Object.freeze;
|
|
function freeze() { [native code for Object.freeze, arity=1] }
|
|
|
|
js> [undefined, null, true, 1, 'hello'].forEach(function(value) {
|
|
> expectTypeError(function() { Object.freeze(value) })
|
|
> })
|
|
js> expectTypeError(function() { Object.freeze() })
|
|
|
|
js> var x = {}
|
|
js> var y = Object.freeze(x)
|
|
js> x === y
|
|
true
|
|
|
|
js> var obj = Object.defineProperty({}, 'a', {configurable:true, writable:true})
|
|
js> var _ = Object.freeze(obj)
|
|
js> var a = Object.getOwnPropertyDescriptor(obj, 'a');
|
|
js> a.configurable
|
|
false
|
|
js> a.writable
|
|
false
|
|
js> Object.isExtensible(obj)
|
|
false
|
|
|
|
js> Object.isFrozen(obj)
|
|
true
|