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); 10 assertTrue(Object.isSealed(sloppy)); 11 var desc = Object.getOwnPropertyDescriptor(sloppy, sym); 12 assertEquals(123, desc.value); 13 assertFalse(desc.configurable); 14 assertTrue(desc.writable); 15 })(); 16 17 18 (function testFreeze() { 19 var sloppy = arguments; 20 var sym = Symbol(); 21 sloppy[sym] = 123; 22 Object.freeze(sloppy); 23 assertTrue(Object.isFrozen(sloppy)); 24 var desc = Object.getOwnPropertyDescriptor(sloppy, sym); 25 assertEquals(123, desc.value); 26 assertFalse(desc.configurable); 27 assertFalse(desc.writable); 28 })(); 29 30 31 (function testIsFrozenAndIsSealed() { 32 var sym = Symbol(); 33 var obj = { [sym]: 123 }; 34 Object.preventExtensions(obj); 35 assertFalse(Object.isFrozen(obj)); 36 assertFalse(Object.isSealed(obj)); 37 })(); 38