tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_strokeText_throw.html (2041B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=728629
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 728629</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11  <script type="application/javascript">
     12 
     13  /** Test for Bug 728629 */
     14  SimpleTest.waitForExplicitFinish();
     15  function test() {
     16    var c = document.createElement('canvas');
     17    document.body.appendChild(c);
     18    try {
     19      c.getContext("2d").strokeText("Hello",NaN,50);
     20      ok(true, "strokeText should not throw with NaN.");
     21    } catch (e) {
     22      ok(false, "strokeText should not throw with NaN.");
     23    }
     24    try {
     25      c.getContext("2d").strokeText("Hello",Infinity,50);
     26      ok(true, "strokeText should not throw with Infinity.");
     27    } catch (e) {
     28      ok(false, "strokeText should not throw with Infinity.");
     29    }
     30    try {
     31      c.getContext("2d").strokeText("Hello",undefined,50);
     32      ok(true, "strokeText should not throw with undefined.");
     33    } catch (e) {
     34      ok(false, "strokeText should not throw with undefined.");
     35    }
     36    try {
     37      c.getContext("2d").fillText("Hello",NaN,50);
     38      ok(true, "fillText should not throw with NaN.");
     39    } catch (e) {
     40      ok(false, "fillText should not throw with NaN.");
     41    }
     42    try {
     43      c.getContext("2d").fillText("Hello",Infinity,50);
     44      ok(true, "fillText should not throw with Infinity.");
     45    } catch (e) {
     46      ok(false, "fillText should not throw with Infinity.");
     47    }
     48    try {
     49      c.getContext("2d").fillText("Hello",undefined,50);
     50      ok(true, "fillText should not throw with undefined.");
     51    } catch (e) {
     52      ok(false, "fillText should not throw with undefined.");
     53    }
     54    SimpleTest.finish();
     55  }
     56 
     57  </script>
     58 </head>
     59 <body onload="test();">
     60 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=728629">Mozilla Bug 728629</a>
     61 <p id="display"></p>
     62 <div id="content" style="display: none">
     63 
     64 </div>
     65 <pre id="test">
     66 </pre>
     67 </body>
     68 </html>