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