toolkit/xre/test/test_fpuhandler.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <head>
     2   <title>Floating-point exception handler test</title>
     3   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     5 <body onload="runTest()">
     6   <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
     8   <script class="testbody" type="application/javascript">
     9   SimpleTest.waitForExplicitFinish();
    11   function doDiv(x, y) {
    12     var z;
    13     z = x / y;
    15     for (i = 0 + x; i < 1000; ++i)
    16       z = y / x;
    18     z = x / y;
    19     return z;
    20   }
    22   function runTest()
    23   {
    24     ok(isNaN(doDiv(0.0, 0.0)), "Undefined division-by-zero doesn't crash");
    26     try {
    27       document.getElementById('plugin1').enableFPExceptions();
    28     }
    29     catch (e) {
    30       ok(true, "No special code to set the FPU bit in the testplugin.");
    31       SimpleTest.finish();
    32       return;
    33     }
    35     ok(isNaN(doDiv(0.0, 0.0)), "Undefined division-by-zero doesn't crash again.");
    36     SimpleTest.finish();
    37   }
    38   </script>

mercurial