Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / tests / js1_8_5 / extensions / proxy-enumerateOwn-duplicates.js
1 // Any copyright is dedicated to the Public Domain.
2 // http://creativecommons.org/licenses/publicdomain/
3
4 //-----------------------------------------------------------------------------
5 var BUGNUMBER = 580200;
6 var summary =
7   'Assertion failure enumerating own properties of proxy returning ' +
8   'duplicated own property name';
9 print(BUGNUMBER + ": " + summary);
10
11 /**************
12  * BEGIN TEST *
13  **************/
14
15 var x = Proxy.create({ keys: function() { return ["0","0"]; } }, [1,2]);
16 var ax = Object.keys(x);
17 assertEq(ax.length, 1, "array: " + ax);
18 assertEq(ax[0], "0");
19
20 var p = Proxy.create({ keys: function() { return ["1","1"]; } }, null);
21 var ap = Object.keys(p);
22 assertEq(ap.length, 1, "array: " + ap);
23 assertEq(ap[0], "1");
24
25 var x = Proxy.create({ getOwnPropertyNames: function() { return ["0","0"]; } }, [1,2]);
26 var ax = Object.getOwnPropertyNames(x);
27 assertEq(ax.length, 1, "array: " + ax);
28 assertEq(ax[0], "0");
29
30 var p = Proxy.create({ getOwnPropertyNames: function() { return ["1","1"]; } }, null);
31 var ap = Object.getOwnPropertyNames(p);
32 assertEq(ap.length, 1, "array: " + ap);
33 assertEq(ap[0], "1");
34
35 /******************************************************************************/
36
37 if (typeof reportCompare === "function")
38   reportCompare(true, true);
39
40 print("All tests passed!");