Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
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"?>
6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
8 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
10 <body xmlns="http://www.w3.org/1999/xhtml">
11 <div id="content" style="display: none"/>
12 </body>
14 <script>
15 var Ci = Components.interfaces;
16 var chromeWindowInterface = Ci.nsIDOMChromeWindow;
18 SimpleTest.waitForExplicitFinish();
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);
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');
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');
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>
63 </window>