1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/bindings/test/test_exceptionThrowing.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=847119 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"> 1.11 + <title>Test for Bug 847119</title> 1.12 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 + <script type="application/javascript"> 1.15 + 1.16 + /** Test for Bug 847119 **/ 1.17 + 1.18 + var xhr = new XMLHttpRequest(); 1.19 + var domthrows = function() { xhr.open(); } 1.20 + 1.21 + var count = 20000; 1.22 + 1.23 + function f() { 1.24 + var k = 0; 1.25 + for (var j = 0; j < count; ++j) { 1.26 + try { domthrows(); } catch(e) { ++k; } 1.27 + } 1.28 + return k; 1.29 + } 1.30 + function g() { return count; } 1.31 + 1.32 + is(f(), count, "Should get count exceptions"); 1.33 + for (var h of [f, g]) { 1.34 + try { is(h(), count, "Should get count exceptions here too"); } catch (e) {} 1.35 + } 1.36 + ok(true, "We should get here"); 1.37 + 1.38 + var domthrows = function() { xhr.withCredentials = false; } 1.39 + xhr.open("GET", ""); 1.40 + xhr.send(); 1.41 + 1.42 + is(f(), count, "Should get count exceptions from getter"); 1.43 + for (var h of [f, g]) { 1.44 + try { is(h(), count, "Should get count exceptions from getter here too"); } catch (e) {} 1.45 + } 1.46 + ok(true, "We should get here too"); 1.47 + 1.48 + </script> 1.49 +</head> 1.50 +<body> 1.51 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=847119">Mozilla Bug 847119</a> 1.52 +<p id="display"></p> 1.53 +<div id="content" style="display: none"> 1.54 + 1.55 +</div> 1.56 +<pre id="test"> 1.57 +</pre> 1.58 +</body> 1.59 +</html>