1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xul/document/test/test_bug757137.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.7 + type="text/css"?> 1.8 + 1.9 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.10 + 1.11 +<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.12 + 1.13 +<body xmlns="http://www.w3.org/1999/xhtml"> 1.14 + <div id="content" style="display: none"/> 1.15 +</body> 1.16 + 1.17 +<script> 1.18 +var Ci = Components.interfaces; 1.19 +var chromeWindowInterface = Ci.nsIDOMChromeWindow; 1.20 + 1.21 +SimpleTest.waitForExplicitFinish(); 1.22 + 1.23 +// Force off out-of-process mozbrowser because we need to grab its 1.24 +// |window| synchronously from here. Out-of-process docshell creation 1.25 +// for mozbrowser haves entirely differently. 1.26 +// XXX why doesn't pushPrefEnv() work here? 1.27 +var ipcTabsWereDisabled; 1.28 +try { 1.29 + ipcTabsWereDisabled = SpecialPowers.getBoolPref("dom.ipc.tabs.disabled"); 1.30 +} catch (e) { 1.31 + ipcTabsWereDisabled = undefined; 1.32 +} 1.33 +SpecialPowers.setBoolPref("dom.ipc.tabs.disabled", true); 1.34 + 1.35 +var otherWindow = window.open("window_bug757137.xul", "", "chrome"); 1.36 +ok(chromeWindowInterface !== null, 'nsIDOMChromeWindow interface is defined'); 1.37 +var otherChromeWindow = null; 1.38 +try { 1.39 + otherChromeWindow = otherWindow.QueryInterface(chromeWindowInterface); 1.40 +} catch(e) { 1.41 + ok(false, 'exception when QI to ChromeWindow'); 1.42 +} 1.43 +ok(otherChromeWindow !== null, 'XUL window should QI to ChromeWindow'); 1.44 + 1.45 +otherWindow.onload = function () { 1.46 + var w = otherWindow.document.getElementById('f').contentWindow; 1.47 + ok(w !== null, 'got the |window| for a mozbrowser iframe'); 1.48 + var chromeWindow = null; 1.49 + try { 1.50 + var chromeWindow = w.QueryInterface(chromeWindowInterface); 1.51 + } catch(e) { } 1.52 + ok(chromeWindow === null, 'mozbrowser iframe should not get ChromeWindow'); 1.53 + 1.54 + otherWindow.close(); 1.55 + SimpleTest.waitForFocus(function() { 1.56 + if (ipcTabsWereDisabled !== undefined) { 1.57 + SpecialPowers.setBoolPref("dom.ipc.tabs.disabled", ipcTabsWereDisabled); 1.58 + } else { 1.59 + SpecialPowers.clearUserPref("dom.ipc.tabs.disabled"); 1.60 + } 1.61 + SimpleTest.finish(); 1.62 + }); 1.63 +}; 1.64 +</script> 1.65 + 1.66 +</window>