test_bug1070049_throw_from_script.xhtml (1437B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?> 3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> 4 <!-- 5 https://bugzilla.mozilla.org/show_bug.cgi?id=1070049 6 --> 7 <window title="Mozilla Bug 1070049" 8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 10 11 <!-- test code goes here --> 12 <script type="application/javascript"> 13 <![CDATA[ 14 15 /** Test for Bug 1070049 */ 16 SimpleTest.waitForExplicitFinish(); 17 addLoadEvent(function() { 18 // Prevent the test from failing when the exception hits onerror. 19 SimpleTest.expectUncaughtException(); 20 21 // Tell the test to expect exactly one console error with the given parameters, 22 // with SimpleTest.finish as a continuation function. 23 SimpleTest.monitorConsole(SimpleTest.finish, [{errorMessage: new RegExp('flimfniffle')}]); 24 25 // Schedule the console accounting (and continuation) to run next, right 26 // after we throw (below). 27 SimpleTest.executeSoon(SimpleTest.endMonitorConsole); 28 29 // Throw. 30 throw new Error("flimfniffle"); 31 }); 32 ]]> 33 </script> 34 35 <!-- test results are displayed in the html:body --> 36 <body xmlns="http://www.w3.org/1999/xhtml"> 37 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1070049" 38 target="_blank">Mozilla Bug 1070049</a> 39 </body> 40 </window>