15.2.3.6-4-321-1.js (1466B)
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-321-1 6 description: > 7 Object.defineProperty - 'O' is an Arguments object of a function 8 that has formal parameters, 'P' is own accessor property of 'O', 9 test TypeError is thrown when updating the [[Get]] attribute value 10 of 'P' which is not configurable (10.6 [[DefineOwnProperty]] step 11 4) 12 includes: [propertyHelper.js] 13 ---*/ 14 15 (function(a, b, c) { 16 function getFunc() { 17 return "genericPropertyString"; 18 } 19 20 function setFunc(value) { 21 this.helpVerifyGet = value; 22 } 23 Object.defineProperty(arguments, "genericProperty", { 24 get: getFunc, 25 set: setFunc, 26 configurable: false 27 }); 28 try { 29 Object.defineProperty(arguments, "genericProperty", { 30 get: function() { 31 return "overideGenericPropertyString"; 32 } 33 }); 34 throw new Test262Error("Expected an exception."); 35 } catch (e) { 36 if (a !== 1) { 37 throw new Test262Error('Expected a === 1, actually ' + a); 38 } 39 40 verifyEqualTo(arguments, "genericProperty", getFunc()); 41 42 verifyWritable(arguments, "genericProperty", "helpVerifyGet"); 43 44 if (!(e instanceof TypeError)) { 45 throw new Test262Error("Expected TypeError, got " + e); 46 } 47 } 48 49 verifyProperty(arguments, "genericProperty", { 50 enumerable: false, 51 configurable: false, 52 }); 53 }(1, 2, 3)); 54 55 reportCompare(0, 0);