content/xul/document/test/test_bug757137.xul

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:bc78d9198304
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
6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
7
8 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
9
10 <body xmlns="http://www.w3.org/1999/xhtml">
11 <div id="content" style="display: none"/>
12 </body>
13
14 <script>
15 var Ci = Components.interfaces;
16 var chromeWindowInterface = Ci.nsIDOMChromeWindow;
17
18 SimpleTest.waitForExplicitFinish();
19
20 // Force off out-of-process mozbrowser because we need to grab its
21 // |window| synchronously from here. Out-of-process docshell creation
22 // for mozbrowser haves entirely differently.
23 // XXX why doesn't pushPrefEnv() work here?
24 var ipcTabsWereDisabled;
25 try {
26 ipcTabsWereDisabled = SpecialPowers.getBoolPref("dom.ipc.tabs.disabled");
27 } catch (e) {
28 ipcTabsWereDisabled = undefined;
29 }
30 SpecialPowers.setBoolPref("dom.ipc.tabs.disabled", true);
31
32 var otherWindow = window.open("window_bug757137.xul", "", "chrome");
33 ok(chromeWindowInterface !== null, 'nsIDOMChromeWindow interface is defined');
34 var otherChromeWindow = null;
35 try {
36 otherChromeWindow = otherWindow.QueryInterface(chromeWindowInterface);
37 } catch(e) {
38 ok(false, 'exception when QI to ChromeWindow');
39 }
40 ok(otherChromeWindow !== null, 'XUL window should QI to ChromeWindow');
41
42 otherWindow.onload = function () {
43 var w = otherWindow.document.getElementById('f').contentWindow;
44 ok(w !== null, 'got the |window| for a mozbrowser iframe');
45 var chromeWindow = null;
46 try {
47 var chromeWindow = w.QueryInterface(chromeWindowInterface);
48 } catch(e) { }
49 ok(chromeWindow === null, 'mozbrowser iframe should not get ChromeWindow');
50
51 otherWindow.close();
52 SimpleTest.waitForFocus(function() {
53 if (ipcTabsWereDisabled !== undefined) {
54 SpecialPowers.setBoolPref("dom.ipc.tabs.disabled", ipcTabsWereDisabled);
55 } else {
56 SpecialPowers.clearUserPref("dom.ipc.tabs.disabled");
57 }
58 SimpleTest.finish();
59 });
60 };
61 </script>
62
63 </window>

mercurial