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