js/src/tests/ecma_5/Date/timeclip.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://creativecommonn.org/licenses/publicdomain/
     4  */
     6 var BUGNUMBER = 747197;
     7 var summary = "TimeClip behavior for very large numbers";
     9 print(BUGNUMBER + ": " + summary);
    11 /**************
    12  * BEGIN TEST *
    13  **************/
    15 function addToLimit(n) { return 8.64e15 + n; }
    17 assertEq(8.64e15 === addToLimit(0.0), true);
    18 assertEq(8.64e15 === addToLimit(0.5), true);
    19 assertEq(8.64e15 === addToLimit(0.5000000000000001), false);
    21 var times =
    22   [Number.MAX_VALUE,
    23    -Number.MAX_VALUE,
    24    Infinity,
    25    -Infinity,
    26    addToLimit(0.5000000000000001),
    27    -addToLimit(0.5000000000000001)];
    29 for (var i = 0, len = times.length; i < len; i++)
    30 {
    31   var d = new Date();
    32   assertEq(d.setTime(times[i]), NaN, "times[" + i + "]");
    33   assertEq(d.getTime(), NaN);
    34   assertEq(d.valueOf(), NaN);
    35 }
    37 /******************************************************************************/
    39 if (typeof reportCompare === "function")
    40   reportCompare(true, true);
    42 print("Tests complete");

mercurial