| 1 |
// This Source Code Form is subject to the terms of the Mozilla Public |
| 2 |
// License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
// file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 4 |
|
| 5 |
js> load('testsrc/doctests/util.js'); |
| 6 |
|
| 7 |
js> Object.seal; |
| 8 |
function seal() { [native code for Object.seal, arity=1] } |
| 9 |
|
| 10 |
js> [undefined, null, true, 1, 'hello'].forEach(function(value) { |
| 11 |
> expectTypeError(function() { Object.seal(value) }) |
| 12 |
> }) |
| 13 |
js> expectTypeError(function() { Object.seal() }) |
| 14 |
|
| 15 |
js> var x = {} |
| 16 |
js> var y = Object.seal(x) |
| 17 |
js> x === y |
| 18 |
true |
| 19 |
|
| 20 |
js> var obj = Object.defineProperty({}, 'a', {configurable:true}) |
| 21 |
js> var _ = Object.seal(obj) |
| 22 |
js> Object.getOwnPropertyDescriptor(obj, 'a').configurable |
| 23 |
false |
| 24 |
js> Object.isExtensible(obj) |
| 25 |
false |
| 26 |
|
| 27 |
js> Object.isSealed(obj) |
| 28 |
true |