| 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-250 |
| 6 |
description: > |
| 7 |
Object.defineProperty - 'O' is an Array, 'name' is an array index |
| 8 |
named property, 'name' is data property and 'desc' is data |
| 9 |
descriptor, and the [[Configurable]] attribute value of 'name' is |
| 10 |
false, test TypeError is thrown if the [[Writable]] attribute |
| 11 |
value of 'name' is false, and the [[Value]] field of 'desc' and |
| 12 |
the [[Value]] attribute value of 'name' are two booleans with |
| 13 |
different values (15.4.5.1 step 4.c) |
| 14 |
includes: [propertyHelper.js] |
| 15 |
---*/ |
| 16 |
|
| 17 |
var arrObj = []; |
| 18 |
|
| 19 |
Object.defineProperty(arrObj, "1", { |
| 20 |
value: false |
| 21 |
}); |
| 22 |
|
| 23 |
try { |
| 24 |
Object.defineProperty(arrObj, "1", { |
| 25 |
value: true |
| 26 |
}); |
| 27 |
$ERROR("Expected an exception."); |
| 28 |
} catch (e) { |
| 29 |
verifyEqualTo(arrObj, "1", false); |
| 30 |
|
| 31 |
verifyNotWritable(arrObj, "1"); |
| 32 |
|
| 33 |
verifyNotEnumerable(arrObj, "1"); |
| 34 |
|
| 35 |
verifyNotConfigurable(arrObj, "1"); |
| 36 |
|
| 37 |
if (!(e instanceof TypeError)) { |
| 38 |
$ERROR("Expected TypeError, got " + e); |
| 39 |
} |
| 40 |
|
| 41 |
} |