| 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-204 |
| 6 |
description: > |
| 7 |
Object.defineProperties - 'O' is an Array, 'P' is an array index |
| 8 |
named property, 'P' property doesn't exist in 'O', test |
| 9 |
[[Configurable]] of 'P' property in 'Attributes' is set as false |
| 10 |
value if [[Configurable]] is absent in accessor descriptor 'desc' |
| 11 |
(15.4.5.1 step 4.c) |
| 12 |
includes: [propertyHelper.js] |
| 13 |
---*/ |
| 14 |
|
| 15 |
var arr = []; |
| 16 |
arr.verifySetter = 100; |
| 17 |
|
| 18 |
Object.defineProperties(arr, { |
| 19 |
"0": { |
| 20 |
set: function(value) { |
| 21 |
arr.verifySetter = value; |
| 22 |
}, |
| 23 |
get: function() { |
| 24 |
return arr.verifySetter; |
| 25 |
}, |
| 26 |
enumerable: true |
| 27 |
} |
| 28 |
}); |
| 29 |
|
| 30 |
if (!Object.prototype.hasOwnProperty.call(arr, "0")) { |
| 31 |
$ERROR("Expected hasOwnProperty to return true."); |
| 32 |
} |
| 33 |
|
| 34 |
arr[0] = 101; |
| 35 |
|
| 36 |
verifyEqualTo(arr, 0, 101); |
| 37 |
|
| 38 |
if (arr.verifySetter !== 101) { |
| 39 |
$ERROR('Expected arr.verifySetter === 101, actually ' + arr.verifySetter); |
| 40 |
} |
| 41 |
|
| 42 |
verifyNotConfigurable(arr, 0); |