test_exceptionThrowing.html (1389B)
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 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 (let 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 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 (let 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>