| 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-191 |
| 6 |
description: > |
| 7 |
Object.defineProperty - 'O' is an Array, 'name' is an array index |
| 8 |
named property, 'name' is an inherited data property, test that |
| 9 |
defining own index named property is successful (15.4.5.1 step 4.c) |
| 10 |
---*/ |
| 11 |
|
| 12 |
try { |
| 13 |
Object.defineProperty(Array.prototype, "0", { |
| 14 |
value: 11, |
| 15 |
configurable: true |
| 16 |
}); |
| 17 |
|
| 18 |
var arrObj = []; |
| 19 |
|
| 20 |
Object.defineProperty(arrObj, "0", { |
| 21 |
configurable: false |
| 22 |
}); |
| 23 |
|
| 24 |
if (!arrObj.hasOwnProperty("0")) { |
| 25 |
$ERROR("Expected arrObj.hasOwnProperty('0') === true, actually " + arrObj.hasOwnProperty("0")); |
| 26 |
} |
| 27 |
if (Array.prototype[0] !== 11) { |
| 28 |
$ERROR("Expected Array.prototype[0] === 11), actually " + Array.prototype[0]); |
| 29 |
} |
| 30 |
if (typeof arrObj[0] !== "undefined") { |
| 31 |
$ERROR("Expected typeof arrObj[0] === 'undefined'), actually " + typeof arrObj[0]); |
| 32 |
} |
| 33 |
|
| 34 |
} finally { |
| 35 |
delete Array.prototype[0]; |
| 36 |
} |