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.

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

mercurial