15.2.3.6-4-223.js (960B)
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-223 6 description: > 7 Object.defineProperty - 'O' is an Array, 'name' is an array index 8 property, test TypeError is thrown when the [[Value]] field of 9 'desc' and the [[Value]] attribute value of 'name' are two strings 10 with different values (15.4.5.1 step 4.c) 11 includes: [propertyHelper.js] 12 ---*/ 13 14 var arrObj = []; 15 16 Object.defineProperty(arrObj, 0, { 17 value: "abcd", 18 writable: false, 19 configurable: false 20 }); 21 22 try { 23 Object.defineProperty(arrObj, "0", { 24 value: "fghj" 25 }); 26 throw new Test262Error("Expected an exception."); 27 } catch (e) { 28 if (!(e instanceof TypeError)) { 29 throw new Test262Error("Expected TypeError, got " + e); 30 } 31 } 32 33 verifyProperty(arrObj, "0", { 34 value: "abcd", 35 writable: false, 36 enumerable: false, 37 configurable: false, 38 }); 39 40 reportCompare(0, 0);