15.2.3.6-4-538-2.js (1654B)
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-538-2 6 description: > 7 ES5 Attributes - Updating a named accessor property 'P' whose 8 [[Configurable]] attribute is true to a data property is 9 successful, 'O' is an Arguments object 10 includes: [propertyHelper.js] 11 ---*/ 12 13 var obj = (function() { 14 return arguments; 15 }()); 16 17 obj.verifySetFunc = "data"; 18 var getFunc = function() { 19 return obj.verifySetFunc; 20 }; 21 22 var setFunc = function(value) { 23 obj.verifySetFunc = value; 24 }; 25 26 Object.defineProperty(obj, "prop", { 27 get: getFunc, 28 set: setFunc, 29 enumerable: true, 30 configurable: true 31 }); 32 var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); 33 34 Object.defineProperty(obj, "prop", { 35 value: 1001 36 }); 37 var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); 38 39 if (!desc1.hasOwnProperty("get")) { 40 throw new Test262Error('Expected desc1.hasOwnProperty("get") to be true, actually ' + desc1.hasOwnProperty("get")); 41 } 42 43 if (!desc2.hasOwnProperty("value")) { 44 throw new Test262Error('Expected desc2.hasOwnProperty("value") to be true, actually ' + desc2.hasOwnProperty("value")); 45 } 46 47 if (typeof desc2.get !== "undefined") { 48 throw new Test262Error('Expected typeof desc2.get === "undefined" , actually ' + typeof desc2.get); 49 } 50 51 if (typeof desc2.set !== "undefined") { 52 throw new Test262Error('Expected typeof desc2.set === "undefined" , actually ' + typeof desc2.set); 53 } 54 55 verifyEqualTo(obj, "prop", 1001); 56 57 verifyNotWritable(obj, "prop"); 58 59 verifyProperty(obj, "prop", { 60 enumerable: true, 61 configurable: true, 62 }); 63 64 reportCompare(0, 0);