dom/bindings/test/test_exceptionThrowing.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:7c8e3839cc37
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">
12
13 /** Test for Bug 847119 **/
14
15 var xhr = new XMLHttpRequest();
16 var domthrows = function() { xhr.open(); }
17
18 var count = 20000;
19
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; }
28
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");
34
35 var domthrows = function() { xhr.withCredentials = false; }
36 xhr.open("GET", "");
37 xhr.send();
38
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");
44
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">
51
52 </div>
53 <pre id="test">
54 </pre>
55 </body>
56 </html>

mercurial