| 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-239 |
| 6 |
description: > |
| 7 |
Object.defineProperty - 'O' is an Array, 'name' is an array index |
| 8 |
named property, TypeError is thrown if the [[Configurable]] |
| 9 |
attribute value of 'name' is false, and [[Enumerable]] of 'desc' |
| 10 |
is present and its value is different from the [[Enumerable]] |
| 11 |
attribute value of 'name' (15.4.5.1 step 4.c) |
| 12 |
includes: [propertyHelper.js] |
| 13 |
---*/ |
| 14 |
|
| 15 |
|
| 16 |
var arrObj = []; |
| 17 |
|
| 18 |
Object.defineProperty(arrObj, "1", { |
| 19 |
value: 3, |
| 20 |
writable: true, |
| 21 |
configurable: false, |
| 22 |
enumerable: false |
| 23 |
}); |
| 24 |
|
| 25 |
try { |
| 26 |
Object.defineProperty(arrObj, "1", { |
| 27 |
value: 13, |
| 28 |
writable: true, |
| 29 |
enumerable: true |
| 30 |
}); |
| 31 |
$ERROR("Expected an exception."); |
| 32 |
|
| 33 |
} catch (e) { |
| 34 |
verifyEqualTo(arrObj, "1", 3); |
| 35 |
|
| 36 |
verifyWritable(arrObj, "1"); |
| 37 |
|
| 38 |
verifyNotEnumerable(arrObj, "1"); |
| 39 |
|
| 40 |
verifyNotConfigurable(arrObj, "1"); |
| 41 |
|
| 42 |
if (!(e instanceof TypeError)) { |
| 43 |
$ERROR("Expected TypeError, got " + e); |
| 44 |
} |
| 45 |
|
| 46 |
} |