js/src/tests/js1_8_5/extensions/proxy-enumerateOwn-duplicates.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // Any copyright is dedicated to the Public Domain.
     2 // http://creativecommons.org/licenses/publicdomain/
     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);
    11 /**************
    12  * BEGIN TEST *
    13  **************/
    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");
    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");
    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");
    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");
    35 /******************************************************************************/
    37 if (typeof reportCompare === "function")
    38   reportCompare(true, true);
    40 print("All tests passed!");

mercurial