15.2.3.9-2-c-3.js (1367B)
1 // Copyright (c) 2012 Ecma International. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 es5id: 15.2.3.9-2-c-3 6 description: > 7 Object.freeze - The [[Configurable]] attribute of all own data 8 property of 'O' is set to false while other attributes are 9 unchanged 10 includes: [propertyHelper.js] 11 ---*/ 12 13 var obj = {}; 14 var resultSetFun = false; 15 16 Object.defineProperty(obj, "foo1", { 17 value: 10, 18 writable: false, 19 enumerable: true, 20 configurable: true 21 }); 22 23 function get_func() { 24 return 10; 25 } 26 27 function set_func() { 28 resultSetFun = true; 29 } 30 31 Object.defineProperty(obj, "foo2", { 32 get: get_func, 33 set: set_func, 34 enumerable: true, 35 configurable: true 36 }); 37 38 Object.freeze(obj); 39 40 verifyProperty(obj, "foo2", { 41 configurable: false, 42 }); 43 44 verifyEqualTo(obj, "foo2", 10); 45 46 obj.foo2 = 12; 47 if (!resultSetFun) { 48 throw new Test262Error('Expected obj["foo2"] set() to be called, but was not.'); 49 } 50 51 verifyProperty(obj, "foo2", { 52 enumerable: true, 53 configurable: false, 54 }); 55 56 var desc2 = Object.getOwnPropertyDescriptor(obj, "foo2"); 57 if (desc2.writable) { 58 throw new Test262Error('Expected obj["foo2"] to be non-writable, non-configurable; actually ' + JSON.stringify(desc2)); 59 } 60 61 verifyProperty(obj, "foo1", { 62 value: 10, 63 writable: false, 64 enumerable: true, 65 configurable: false, 66 }); 67 68 reportCompare(0, 0);