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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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