|
1 /// Copyright (c) 2012 Ecma International. All rights reserved. |
|
2 /// Ecma International makes this code available under the terms and conditions set |
|
3 /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the |
|
4 /// "Use Terms"). Any redistribution of this code must retain the above |
|
5 /// copyright and this notice and otherwise comply with the Use Terms. |
|
6 /** |
|
7 * Refer 11.1.4; |
|
8 * The production |
|
9 * ElementList : Elisionopt AssignmentExpression |
|
10 * 5.Call the [[DefineOwnProperty]] internal method of array with arguments ToString(firstIndex), the Property Descriptor { [[Value]]: initValue, [[Writable]]: true |
|
11 * , [[Enumerable]]: true, [[Configurable]]: true}, and false. |
|
12 * |
|
13 * @path ch11/11.1/11.1.4/11.1.4_4-5-1.js |
|
14 * @description Initialize array using ElementList (Elisionopt AssignmentExpression) when index property (read-only) exists in Array.prototype (step 5) |
|
15 */ |
|
16 |
|
17 |
|
18 function testcase() { |
|
19 try { |
|
20 Object.defineProperty(Array.prototype, "0", { |
|
21 value: 100, |
|
22 writable: false, |
|
23 configurable: true |
|
24 }); |
|
25 var arr = [101]; |
|
26 |
|
27 return arr.hasOwnProperty("0") && arr[0] === 101; |
|
28 } finally { |
|
29 delete Array.prototype[0]; |
|
30 } |
|
31 } |
|
32 runTestCase(testcase); |