15.2.3.6-4-107.js (863B)
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.6-4-107 6 description: > 7 Object.defineProperty - 'name' and 'desc' are accessor properties, 8 both desc.[[Get]] and name.[[Get]] are two different values 9 (8.12.9 step 12) 10 includes: [propertyHelper.js] 11 ---*/ 12 13 14 var obj = {}; 15 16 function getFunc() { 17 return 10; 18 } 19 20 function setFunc(value) { 21 obj.setVerifyHelpProp = value; 22 } 23 24 Object.defineProperty(obj, "foo", { 25 get: getFunc, 26 set: setFunc, 27 configurable: true 28 }); 29 30 function getFunc2() { 31 return 20; 32 } 33 34 Object.defineProperty(obj, "foo", { 35 get: getFunc2 36 }); 37 verifyEqualTo(obj, "foo", getFunc2()); 38 39 verifyWritable(obj, "foo", "setVerifyHelpProp"); 40 41 verifyProperty(obj, "foo", { 42 enumerable: false, 43 configurable: true, 44 }); 45 46 reportCompare(0, 0);