Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
4 * Contributor:
5 * Jeff Walden <jwalden+code@mit.edu>
6 */
8 //-----------------------------------------------------------------------------
9 var BUGNUMBER = 518663;
10 var summary = 'Object.getOwnPropertyNames: array objects';
12 print(BUGNUMBER + ": " + summary);
14 /**************
15 * BEGIN TEST *
16 **************/
18 var a, names, expected;
20 function arraysEqual(a1, a2)
21 {
22 return a1.length === a2.length &&
23 a1.every(function(v, i) { return v === a2[i]; });
24 }
27 a = [0, 1, 2];
29 names = Object.getOwnPropertyNames(a).sort();
30 expected = ["0", "1", "2", "length"].sort();
32 a = [1, , , 7];
33 a.p = 2;
34 Object.defineProperty(a, "q", { value: 42, enumerable: false });
36 names = Object.getOwnPropertyNames(a).sort();
37 expected = ["0", "3", "p", "q", "length"].sort();
38 assertEq(arraysEqual(names, expected), true);
41 a = [];
43 names = Object.getOwnPropertyNames(a).sort();
44 expected = ["length"];
45 assertEq(arraysEqual(names, expected), true);
48 /******************************************************************************/
50 reportCompare(true, true);
52 print("All tests passed!");