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="Menuitem Commands Test"
6 onload="runOrOpen()"
7 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script type="application/javascript"
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
12 <script>
13 <![CDATA[
14 SimpleTest.waitForExplicitFinish();
16 function checkAttributes(elem, label, accesskey, disabled, hidden, isAfter)
17 {
18 var is = window.opener.wrappedJSObject.SimpleTest.is;
20 is(elem.getAttribute("label"), label, elem.id + " label " + (isAfter ? "after" : "before") + " open");
21 is(elem.getAttribute("accesskey"), accesskey, elem.id + " accesskey " + (isAfter ? "after" : "before") + " open");
22 is(elem.getAttribute("disabled"), disabled, elem.id + " disabled " + (isAfter ? "after" : "before") + " open");
23 is(elem.getAttribute("hidden"), hidden, elem.id + " hidden " + (isAfter ? "after" : "before") + " open");
24 }
26 function runOrOpen()
27 {
28 if (window.opener) {
29 SimpleTest.waitForFocus(runTest);
30 }
31 else {
32 window.open("test_menuitem_commands.xul", "", "chrome");
33 }
34 }
36 function runTest()
37 {
38 runTestSet("");
39 runTestSet("bar");
40 window.close();
41 window.opener.wrappedJSObject.SimpleTest.finish();
42 }
44 function runTestSet(suffix)
45 {
46 var isMac = (navigator.platform.indexOf("Mac") >= 0);
48 var one = $("one" + suffix);
49 var two = $("two" + suffix);
50 var three = $("three" + suffix);
51 var four = $("four" + suffix);
53 checkAttributes(one, "One", "", "", "true", false);
54 checkAttributes(two, "", "", "false", "", false);
55 checkAttributes(three, "Three", "T", "true", "", false);
56 checkAttributes(four, "Four", "F", "", "", false);
58 if (isMac && suffix) {
59 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
60 getInterface(Components.interfaces.nsIDOMWindowUtils);
61 utils.forceUpdateNativeMenuAt("0");
62 }
63 else {
64 $("menu" + suffix).open = true;
65 }
67 checkAttributes(one, "One", "", "", "false", true);
68 checkAttributes(two, "Cat", "C", "", "", true);
69 checkAttributes(three, "Dog", "D", "false", "true", true);
70 checkAttributes(four, "Four", "F", "true", "", true);
72 $("menu" + suffix).open = false;
73 }
74 ]]>
75 </script>
77 <command id="cmd_one" hidden="false"/>
78 <command id="cmd_two" label="Cat" accesskey="C"/>
79 <command id="cmd_three" label="Dog" accesskey="D" disabled="false" hidden="true"/>
80 <command id="cmd_four" disabled="true"/>
82 <button id="menu" type="menu">
83 <menupopup>
84 <menuitem id="one" label="One" hidden="true" command="cmd_one"/>
85 <menuitem id="two" disabled="false" command="cmd_two"/>
86 <menuitem id="three" label="Three" accesskey="T" disabled="true" command="cmd_three"/>
87 <menuitem id="four" label="Four" accesskey="F" command="cmd_four"/>
88 </menupopup>
89 </button>
91 <menubar>
92 <menu id="menubar" label="Sample">
93 <menupopup>
94 <menuitem id="onebar" label="One" hidden="true" command="cmd_one"/>
95 <menuitem id="twobar" disabled="false" command="cmd_two"/>
96 <menuitem id="threebar" label="Three" accesskey="T" disabled="true" command="cmd_three"/>
97 <menuitem id="fourbar" label="Four" accesskey="F" command="cmd_four"/>
98 </menupopup>
99 </menu>
100 </menubar>
102 <body xmlns="http://www.w3.org/1999/xhtml"><p id="display"/></body>
104 </window>