dom/bindings/test/test_exceptionThrowing.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=847119
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test for Bug 847119</title>
     9   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11   <script type="application/javascript">
    13   /** Test for Bug 847119 **/
    15   var xhr = new XMLHttpRequest();
    16   var domthrows = function() { xhr.open();  }
    18   var count = 20000;
    20   function f() {
    21     var k = 0;
    22     for (var j = 0; j < count; ++j) {
    23       try { domthrows(); } catch(e) { ++k; }
    24     }
    25     return k;
    26   }
    27   function g() { return count; }
    29   is(f(), count, "Should get count exceptions");
    30   for (var h of [f, g]) {
    31     try { is(h(), count, "Should get count exceptions here too"); } catch (e) {}
    32   }
    33   ok(true, "We should get here");
    35   var domthrows = function() { xhr.withCredentials = false; }
    36   xhr.open("GET", "");
    37   xhr.send();
    39   is(f(), count, "Should get count exceptions from getter");
    40   for (var h of [f, g]) {
    41     try { is(h(), count, "Should get count exceptions from getter here too"); } catch (e) {}
    42   }
    43   ok(true, "We should get here too");
    45   </script>
    46 </head>
    47 <body>
    48 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=847119">Mozilla Bug 847119</a>
    49 <p id="display"></p>
    50 <div id="content" style="display: none">
    52 </div>
    53 <pre id="test">
    54 </pre>
    55 </body>
    56 </html>

mercurial