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