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