toolkit/xre/test/test_fpuhandler.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial