15.2.3.7-6-a-241.js (1176B)
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-241 6 description: > 7 Object.defineProperties - TypeError is thrown if 'O' is an Array, 8 'P' is an array index named property that already exists on 'O' is 9 accessor property with [[Configurable]] false, 'desc' is accessor 10 descriptor, the [[Set]] field of 'desc' is present, and the 11 [[Set]] field of 'desc' and the [[Set]] attribute value of 'P' are 12 two objects which refer to the different objects (15.4.5.1 step 13 4.c) 14 includes: [propertyHelper.js] 15 ---*/ 16 17 var arr = []; 18 19 function set_fun(value) { 20 arr.setVerifyHelpProp = value; 21 } 22 Object.defineProperty(arr, "1", { 23 set: set_fun 24 }); 25 26 try { 27 Object.defineProperties(arr, { 28 "1": { 29 set: function() {} 30 } 31 }); 32 33 throw new Test262Error("Expected an exception."); 34 } catch (e) { 35 verifyWritable(arr, "1", "setVerifyHelpProp"); 36 37 if (!(e instanceof TypeError)) { 38 throw new Test262Error("Expected TypeError, got " + e); 39 } 40 } 41 42 verifyProperty(arr, "1", { 43 enumerable: false, 44 configurable: false, 45 }); 46 47 reportCompare(0, 0);