Sat, 03 Jan 2015 20:18:00 +0100
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 // If x is NaN, the result is NaN.
2 assertEq(Math.trunc(NaN), NaN);
4 // If x is −0, the result is −0.
5 assertEq(Math.trunc(-0), -0);
7 // If x is +0, the result is +0.
8 assertEq(Math.trunc(+0), +0);
10 // If x is +∞, the result is +∞.
11 assertEq(Math.trunc(Infinity), Infinity);
13 // If x is −∞, the result is −∞.
14 assertEq(Math.trunc(-Infinity), -Infinity);
16 // Other boundary cases.
17 var MAX_NONINTEGER_VALUE = 4503599627370495.5;
18 var TRUNC_MAX_NONINTEGER_VALUE = 4503599627370495;
20 assertEq(Math.trunc(Number.MIN_VALUE), +0);
21 assertEq(Math.trunc(ONE_MINUS_EPSILON), +0);
22 assertEq(Math.trunc(ONE_PLUS_EPSILON), 1);
23 assertEq(Math.trunc(MAX_NONINTEGER_VALUE), TRUNC_MAX_NONINTEGER_VALUE);
24 assertEq(Math.trunc(Number.MAX_VALUE), Number.MAX_VALUE);
26 assertEq(Math.trunc(-Number.MIN_VALUE), -0);
27 assertEq(Math.trunc(-ONE_MINUS_EPSILON), -0);
28 assertEq(Math.trunc(-ONE_PLUS_EPSILON), -1);
29 assertEq(Math.trunc(-MAX_NONINTEGER_VALUE), -TRUNC_MAX_NONINTEGER_VALUE);
30 assertEq(Math.trunc(-Number.MAX_VALUE), -Number.MAX_VALUE);
32 // Other cases.
33 for (var i = 1, f = 1.1; i < 20; i++, f += 1.0)
34 assertEq(Math.trunc(f), i);
36 for (var i = -1, f = -1.1; i > -20; i--, f -= 1.0)
37 assertEq(Math.trunc(f), i);
39 assertEq(Math.trunc(1e40 + 0.5), 1e40);
41 assertEq(Math.trunc(1e300), 1e300);
42 assertEq(Math.trunc(-1e300), -1e300);
43 assertEq(Math.trunc(1e-300), 0);
44 assertEq(Math.trunc(-1e-300), -0);
46 assertEq(Math.trunc(+0.9999), +0);
47 assertEq(Math.trunc(-0.9999), -0);
50 reportCompare(0, 0, "ok");