js/src/tests/ecma_6/Map/NaN-as-key.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 /*
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/licenses/publicdomain/
     4  */
     6 //-----------------------------------------------------------------------------
     7 var BUGNUMBER = 722260;
     8 var summary = 'All NaNs must be treated as identical keys for Map';
    10 print(BUGNUMBER + ": " + summary);
    12 /**************
    13  * BEGIN TEST *
    14  **************/
    16 /* Avoid constant-folding that would happen were |undefined| to be used. */
    17 var key = -/a/g.missingProperty;
    19 var m = new Map();
    20 m.set(key, 17);
    21 assertEq(m.get(key), 17);
    22 assertEq(m.get(-key), 17);
    23 assertEq(m.get(NaN), 17);
    25 m.delete(-key);
    26 assertEq(m.has(key), false);
    27 assertEq(m.has(-key), false);
    28 assertEq(m.has(NaN), false);
    30 m.set(-key, 17);
    31 assertEq(m.get(key), 17);
    32 assertEq(m.get(-key), 17);
    33 assertEq(m.get(NaN), 17);
    35 m.delete(NaN);
    36 assertEq(m.has(key), false);
    37 assertEq(m.has(-key), false);
    38 assertEq(m.has(NaN), false);
    40 m.set(NaN, 17);
    41 assertEq(m.get(key), 17);
    42 assertEq(m.get(-key), 17);
    43 assertEq(m.get(NaN), 17);
    45 m.delete(key);
    46 assertEq(m.has(key), false);
    47 assertEq(m.has(-key), false);
    48 assertEq(m.has(NaN), false);
    50 /******************************************************************************/
    52 if (typeof reportCompare === "function")
    53   reportCompare(true, true);
    55 print("Tests complete");

mercurial