test_bug793433.xul 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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=793433
  6. -->
  7. <window title="Mozilla Bug 793433"
  8. xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  9. <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
  10. <!-- test results are displayed in the html:body -->
  11. <body xmlns="http://www.w3.org/1999/xhtml">
  12. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=793433"
  13. target="_blank">Mozilla Bug 793433</a>
  14. <p id="display"></p>
  15. <div id="content" style="display: none"/>
  16. </body>
  17. <!-- test code goes here -->
  18. <script type="application/javascript"><![CDATA[
  19. var Cc = Components.classes;
  20. var Ci = Components.interfaces;
  21. function shouldThrow(fun, args, msg) {
  22. try {
  23. fun.apply(this, args);
  24. ok(false, msg);
  25. } catch (e) {
  26. ok(true, msg+" -- "+e);
  27. }
  28. }
  29. function do_registerTopLevelWindow(win) {
  30. Cc['@mozilla.org/appshell/appShellService;1'].
  31. getService(Ci.nsIAppShellService).registerTopLevelWindow(win);
  32. }
  33. shouldThrow(
  34. do_registerTopLevelWindow, [null],
  35. "registering null as a top-level window should throw");
  36. shouldThrow(
  37. do_registerTopLevelWindow, [{}],
  38. "registering a void object as a top-level window should throw");
  39. ]]></script>
  40. </window>