js/src/tests/js1_5/Regress/regress-329383.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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 //-----------------------------------------------------------------------------
michael@0 7 var BUGNUMBER = 329383;
michael@0 8 var summary = 'Math copysign issues';
michael@0 9 var actual = '';
michael@0 10 var expect = '';
michael@0 11
michael@0 12 printBugNumber(BUGNUMBER);
michael@0 13 printStatus (summary);
michael@0 14
michael@0 15 var inputs = [
michael@0 16 -Infinity,
michael@0 17 -10.01,
michael@0 18 -9.01,
michael@0 19 -8.01,
michael@0 20 -7.01,
michael@0 21 -6.01,
michael@0 22 -5.01,
michael@0 23 -4.01,
michael@0 24 -Math.PI,
michael@0 25 -3.01,
michael@0 26 -2.01,
michael@0 27 -1.01,
michael@0 28 -0.5,
michael@0 29 -0.49,
michael@0 30 -0.01,
michael@0 31 -0,
michael@0 32 0,
michael@0 33 +0,
michael@0 34 0.01,
michael@0 35 0.49,
michael@0 36 0.50,
michael@0 37 0,
michael@0 38 1.01,
michael@0 39 2.01,
michael@0 40 3.01,
michael@0 41 Math.PI,
michael@0 42 4.01,
michael@0 43 5.01,
michael@0 44 6.01,
michael@0 45 7.01,
michael@0 46 8.01,
michael@0 47 9.01,
michael@0 48 10.01,
michael@0 49 Infinity
michael@0 50 ];
michael@0 51
michael@0 52 var iinput;
michael@0 53
michael@0 54 for (iinput = 0; iinput < inputs.length; iinput++)
michael@0 55 {
michael@0 56 var input = inputs[iinput];
michael@0 57 reportCompare(Math.round(input),
michael@0 58 emulateRound(input),
michael@0 59 summary + ': Math.round(' + input + ')');
michael@0 60 }
michael@0 61
michael@0 62 reportCompare(isNaN(Math.round(NaN)),
michael@0 63 isNaN(emulateRound(NaN)),
michael@0 64 summary + ': Math.round(' + input + ')');
michael@0 65
michael@0 66 function emulateRound(x)
michael@0 67 {
michael@0 68 if (!isFinite(x) || x === 0) return x
michael@0 69 if (-0.5 <= x && x < 0) return -0
michael@0 70 return Math.floor(x + 0.5)
michael@0 71 }
michael@0 72
michael@0 73 var z;
michael@0 74
michael@0 75 z = Math.min(-0, 0);
michael@0 76
michael@0 77 reportCompare(-Math.PI, Math.atan2(z, z), summary + ': Math.atan2(-0, -0)');
michael@0 78 reportCompare(-Infinity, 1/z, summary + ': 1/-0');
michael@0 79
michael@0 80 z = Math.max(-0, 0);
michael@0 81
michael@0 82 reportCompare(0, Math.atan2(z, z), summary + ': Math.atan2(0, 0)');
michael@0 83 reportCompare(Infinity, 1/z, summary + ': 1/0');

mercurial