15.2.3.6-4-168.js (984B)
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-168 6 description: > 7 Object.defineProperty - 'O' is an Array, 'name' is the length 8 property of 'O', whose writable attribute is being changed to 9 false and the [[Value]] field of 'desc' is less than value of the 10 length property and also lesser than an index of the array which 11 is set to configurable:false, test that new length is set to a 12 value greater than the non-deletable index by 1, writable 13 attribute of length is set to false and TypeError exception is 14 thrown (15.4.5.1 step 3.i.iii) 15 ---*/ 16 17 var arrObj = [0, 1, 2]; 18 assert.throws(TypeError, function() { 19 Object.defineProperty(arrObj, "1", { 20 configurable: false 21 }); 22 23 Object.defineProperty(arrObj, "length", { 24 value: 0, 25 writable: false 26 }); 27 }); 28 assert.sameValue(arrObj.length, 2, 'arrObj.length'); 29 30 reportCompare(0, 0);