test_bug763343.xul 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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=763343
  6. -->
  7. <window title="Mozilla Bug 763343"
  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=763343"
  13. target="_blank">Mozilla Bug 763343</a>
  14. </body>
  15. <!-- test code goes here -->
  16. <script type="application/javascript">
  17. <![CDATA[
  18. /** Test for Cross-compartment nsIClassInfo singleton wrapping. **/
  19. const Cc = Components.classes;
  20. const Ci = Components.interfaces;
  21. const Cu = Components.utils;
  22. // We need an object here that has singleton classinfo. For now, the console
  23. // service works.
  24. var singleton = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIClassInfo);
  25. ok(singleton.flags & Ci.nsIClassInfo.SINGLETON_CLASSINFO,
  26. "Should have singleton classinfo");
  27. var sb = new Cu.Sandbox(window);
  28. // Don't crash.
  29. sb.singleton = singleton;
  30. ok(true, "didn't crash");
  31. ]]>
  32. </script>
  33. </window>