Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 (function testSeal() { | |
| 6 var sloppy = arguments; | |
| 7 var sym = Symbol(); | |
| 8 sloppy[sym] = 123; | |
| 9 Object.seal(sloppy); | |
|
rossberg
2015/10/15 12:12:55
Check Object.isSealed(sloppy) here (analogous belo
adamk
2015/10/15 12:29:32
Done and done (though the return value of that in
| |
| 10 var desc = Object.getOwnPropertyDescriptor(sloppy, sym); | |
| 11 assertEquals(123, desc.value); | |
| 12 assertFalse(desc.configurable); | |
| 13 assertTrue(desc.writable); | |
| 14 })(); | |
| 15 | |
| 16 | |
| 17 (function testFreeze() { | |
| 18 var sloppy = arguments; | |
| 19 var sym = Symbol(); | |
| 20 sloppy[sym] = 123; | |
| 21 Object.freeze(sloppy); | |
| 22 var desc = Object.getOwnPropertyDescriptor(sloppy, sym); | |
| 23 assertEquals(123, desc.value); | |
| 24 assertFalse(desc.configurable); | |
| 25 assertFalse(desc.writable); | |
| 26 })(); | |
| 27 | |
| 28 | |
| 29 (function testIsFrozenAndIsSealed() { | |
| 30 var sym = Symbol(); | |
| 31 var obj = { [sym]: 123 }; | |
| 32 Object.preventExtensions(obj); | |
| 33 assertFalse(Object.isFrozen(obj)); | |
| 34 assertFalse(Object.isSealed(obj)); | |
| 35 })(); | |
| OLD | NEW |