test_bug1070049_throw_from_script.xul 1.4 KB

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