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" type="text/css"?>
5 <window title="Preferences Window beforeaccept Tests"
6 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
8 <script type="application/javascript"
9 src="chrome://mochikit/content/MochiKit/packed.js"/>
10 <script type="application/javascript"
11 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
13 <script type="application/javascript">
14 <![CDATA[
15 SimpleTest.waitForExplicitFinish();
17 // No instant-apply for this test
18 SpecialPowers.setBoolPref("browser.preferences.instantApply", false);
20 var prefWindow = openDialog("window_preferences_beforeaccept.xul", "", "", windowOnload);
22 SimpleTest.registerCleanupFunction(() => {
23 SpecialPowers.clearUserPref("browser.preferences.instantApply");
24 SpecialPowers.clearUserPref("tests.beforeaccept.dialogShown");
25 SpecialPowers.clearUserPref("tests.beforeaccept.called");
26 });
28 function windowOnload() {
29 var dialogShown = prefWindow.document.getElementById("tests.beforeaccept.dialogShown");
30 var called = prefWindow.document.getElementById("tests.beforeaccept.called");
31 is(dialogShown.value, true, "dialog opened, shown pref set");
32 is(dialogShown.valueFromPreferences, null, "shown pref not committed");
33 is(called.value, null, "beforeaccept not yet called");
34 is(called.valueFromPreferences, null, "beforeaccept not yet called, pref not committed");
36 // try to accept the dialog, should fail the first time
37 prefWindow.document.documentElement.acceptDialog();
38 is(prefWindow.closed, false, "window not closed");
39 is(dialogShown.value, true, "shown pref still set");
40 is(dialogShown.valueFromPreferences, null, "shown pref still not committed");
41 is(called.value, true, "beforeaccept called");
42 is(called.valueFromPreferences, null, "called pref not committed");
44 // try again, this one should succeed
45 prefWindow.document.documentElement.acceptDialog();
46 is(prefWindow.closed, true, "window now closed");
47 is(dialogShown.valueFromPreferences, true, "shown pref committed");
48 is(called.valueFromPreferences, true, "called pref committed");
50 SimpleTest.finish();
51 }
52 ]]>
53 </script>
55 <body xmlns="http://www.w3.org/1999/xhtml">
56 <p id="display"></p>
57 <div id="content" style="display: none"></div>
58 <pre id="test"></pre>
59 </body>
61 </window>