js/src/tests/ecma_5/Number/conversion-invalid-precision.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 = 795745;
     7 var summary =
     8   "Number.prototype.to* should throw a RangeError when passed a bad precision";
    10 print(BUGNUMBER + ": " + summary);
    12 /**************
    13  * BEGIN TEST *
    14  **************/
    16 function test(method, prec)
    17 {
    18   try
    19   {
    20     Number.prototype[method].call(0, prec);
    21     throw "should have thrown";
    22   }
    23   catch (e)
    24   {
    25     assertEq(e instanceof RangeError, true,
    26              "expected RangeError for " + method + " with precision " + prec +
    27              ", got " + e);
    28   }
    29 }
    31 test("toExponential", -32);
    32 test("toFixed", -32);
    33 test("toPrecision", -32);
    35 test("toExponential", 9999999);
    36 test("toFixed", 9999999);
    37 test("toPrecision", 9999999);
    39 test("toPrecision", 0);
    41 /******************************************************************************/
    43 if (typeof reportCompare === "function")
    44   reportCompare(true, true);
    46 print("Tests complete");

mercurial