| 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-241 |
| 6 |
description: > |
| 7 |
Object.defineProperty - 'O' is an Array, 'name' is an array index |
| 8 |
named property, TypeError is thrown if 'name' is data property, |
| 9 |
and'desc' is accessor descriptor, and the [[Configurable]] |
| 10 |
attribute value of 'name' is false (15.4.5.1 step 4.c) |
| 11 |
includes: [propertyHelper.js] |
| 12 |
---*/ |
| 13 |
|
| 14 |
|
| 15 |
var arrObj = []; |
| 16 |
|
| 17 |
Object.defineProperty(arrObj, "1", { |
| 18 |
value: 3, |
| 19 |
configurable: false |
| 20 |
}); |
| 21 |
|
| 22 |
try { |
| 23 |
Object.defineProperty(arrObj, "1", { |
| 24 |
set: function() {} |
| 25 |
}); |
| 26 |
$ERROR("Expected an exception."); |
| 27 |
|
| 28 |
} catch (e) { |
| 29 |
verifyEqualTo(arrObj, "1", 3); |
| 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 |
} |