content/xul/document/test/test_bug757137.xul

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial