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