15.2.3.6-4-540-3.js (1642B)
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-540-3 6 description: > 7 Object.defineProperty fails to update [[Get]] and [[Set]] 8 attributes of a named accessor property 'P' whose [[Configurable]] 9 attribute is false, 'O' is an Arguments object (8.12.9 step 11.a) 10 includes: [propertyHelper.js] 11 ---*/ 12 13 var obj = (function() { 14 return arguments; 15 }()); 16 17 obj.verifySetFunction = "data"; 18 var getFunc = function() { 19 return obj.verifySetFunction; 20 }; 21 var setFunc = function(value) { 22 obj.verifySetFunction = value; 23 }; 24 Object.defineProperty(obj, "property", { 25 get: getFunc, 26 set: setFunc, 27 configurable: false 28 }); 29 30 var result = false; 31 try { 32 Object.defineProperty(obj, "property", { 33 get: function() { 34 return 100; 35 } 36 }); 37 } catch (e) { 38 result = e instanceof TypeError; 39 verifyEqualTo(obj, "property", getFunc()); 40 41 verifyWritable(obj, "property", "verifySetFunction"); 42 } 43 44 verifyProperty(obj, "property", { 45 enumerable: false, 46 configurable: false, 47 }); 48 49 try { 50 Object.defineProperty(obj, "property", { 51 set: function(value) { 52 obj.verifySetFunction1 = value; 53 } 54 }); 55 } catch (e) { 56 57 if (!result) { 58 throw new Test262Error('Expected result to be true, actually ' + result); 59 } 60 61 verifyEqualTo(obj, "property", getFunc()); 62 63 verifyWritable(obj, "property", "verifySetFunction"); 64 65 if (!(e instanceof TypeError)) { 66 throw new Test262Error("Expected TypeError, got " + e); 67 } 68 } 69 70 verifyProperty(obj, "property", { 71 enumerable: false, 72 configurable: false, 73 }); 74 75 reportCompare(0, 0);