15.2.3.7-6-a-274.js (1126B)
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.7-6-a-274 6 description: > 7 Object.defineProperties - 'O' is an Array, 'P' is generic own 8 accessor property of 'O', test TypeError is thrown when updating 9 the [[Get]] attribute value of 'P' which is defined as 10 non-configurable (15.4.5.1 step 5) 11 includes: [propertyHelper.js] 12 ---*/ 13 14 var arr = []; 15 16 function get_fun() { 17 return 37; 18 } 19 20 function set_fun(value) { 21 arr.verifySetFun = value; 22 } 23 Object.defineProperty(arr, "property", { 24 get: get_fun, 25 set: set_fun 26 }); 27 28 try { 29 Object.defineProperties(arr, { 30 "property": { 31 get: function() { 32 return 36; 33 } 34 } 35 }); 36 throw new Test262Error("Expected an exception."); 37 } catch (e) { 38 verifyEqualTo(arr, "property", get_fun()); 39 40 verifyWritable(arr, "property", "verifySetFun"); 41 42 if (!(e instanceof TypeError)) { 43 throw new Test262Error("Expected TypeError, got " + e); 44 } 45 } 46 47 verifyProperty(arr, "property", { 48 enumerable: false, 49 configurable: false, 50 }); 51 52 reportCompare(0, 0);