| 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-113 |
| 6 |
description: > |
| 7 |
Object.defineProperties - 'O' is an Array, test the length |
| 8 |
property of 'O' is own data property that overrides an inherited |
| 9 |
data property (15.4.5.1 step 1) |
| 10 |
---*/ |
| 11 |
|
| 12 |
var arrProtoLen; |
| 13 |
var arr = [0, 1, 2]; |
| 14 |
|
| 15 |
assert.throws(TypeError, function() { |
| 16 |
arrProtoLen = Array.prototype.length; |
| 17 |
Array.prototype.length = 0; |
| 18 |
|
| 19 |
Object.defineProperty(arr, "2", { |
| 20 |
configurable: false |
| 21 |
}); |
| 22 |
|
| 23 |
Object.defineProperties(arr, { |
| 24 |
length: { |
| 25 |
value: 1 |
| 26 |
} |
| 27 |
}); |
| 28 |
}); |
| 29 |
|
| 30 |
var desc = Object.getOwnPropertyDescriptor(arr, "length"); |
| 31 |
assert.sameValue(desc.value, 3, 'desc.value'); |
| 32 |
assert(desc.writable, 'desc.writable !== true'); |
| 33 |
assert.sameValue(desc.enumerable, false, 'desc.enumerable'); |
| 34 |
assert.sameValue(desc.configurable, false, 'desc.configurable'); |