test_bug757137.xul 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?xml version="1.0"?>
  2. <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
  3. <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
  4. type="text/css"?>
  5. <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  6. <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
  7. <body xmlns="http://www.w3.org/1999/xhtml">
  8. <div id="content" style="display: none"/>
  9. </body>
  10. <script>
  11. var Ci = Components.interfaces;
  12. var chromeWindowInterface = Ci.nsIDOMChromeWindow;
  13. SimpleTest.waitForExplicitFinish();
  14. // Force off out-of-process mozbrowser because we need to grab its
  15. // |window| synchronously from here. Out-of-process docshell creation
  16. // for mozbrowser haves entirely differently.
  17. // XXX why doesn't pushPrefEnv() work here?
  18. var otherWindow = window.open("window_bug757137.xul", "", "chrome");
  19. ok(chromeWindowInterface !== null, 'nsIDOMChromeWindow interface is defined');
  20. var otherChromeWindow = null;
  21. try {
  22. otherChromeWindow = otherWindow.QueryInterface(chromeWindowInterface);
  23. } catch(e) {
  24. ok(false, 'exception when QI to ChromeWindow');
  25. }
  26. ok(otherChromeWindow !== null, 'XUL window should QI to ChromeWindow');
  27. SpecialPowers.pushPrefEnv({"set":[["dom.ipc.tabs.disabled", true]]}, startTest);
  28. function startTest() {
  29. otherWindow.onload = function () {
  30. var w = otherWindow.document.getElementById('f').contentWindow;
  31. ok(w !== null, 'got the |window| for a mozbrowser iframe');
  32. var chromeWindow = null;
  33. try {
  34. var chromeWindow = w.QueryInterface(chromeWindowInterface);
  35. } catch(e) { }
  36. ok(chromeWindow === null, 'mozbrowser iframe should not get ChromeWindow');
  37. otherWindow.close();
  38. SimpleTest.waitForFocus(SimpleTest.finish);
  39. };
  40. }
  41. </script>
  42. </window>