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="Menu closemenu Attribute Tests" |
michael@0 | 6 | onload="setTimeout(nextTest, 0);" |
michael@0 | 7 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 11 | |
michael@0 | 12 | <button id="menu" type="menu" label="Menu" onpopuphidden="popupHidden(event)"> |
michael@0 | 13 | <menupopup id="p1" onpopupshown="if (event.target == this) this.firstChild.open = true"> |
michael@0 | 14 | <menu id="l1" label="One"> |
michael@0 | 15 | <menupopup id="p2" onpopupshown="if (event.target == this) this.firstChild.open = true"> |
michael@0 | 16 | <menu id="l2" label="Two"> |
michael@0 | 17 | <menupopup id="p3" onpopupshown="executeMenuItem()"> |
michael@0 | 18 | <menuitem id="l3" label="Three"/> |
michael@0 | 19 | </menupopup> |
michael@0 | 20 | </menu> |
michael@0 | 21 | </menupopup> |
michael@0 | 22 | </menu> |
michael@0 | 23 | </menupopup> |
michael@0 | 24 | </button> |
michael@0 | 25 | |
michael@0 | 26 | <script class="testbody" type="application/javascript"> |
michael@0 | 27 | <![CDATA[ |
michael@0 | 28 | |
michael@0 | 29 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 30 | |
michael@0 | 31 | var gExpectedId = "p3"; |
michael@0 | 32 | var gMode = -1; |
michael@0 | 33 | var gModes = ["", "auto", "single", "none"]; |
michael@0 | 34 | |
michael@0 | 35 | function nextTest() |
michael@0 | 36 | { |
michael@0 | 37 | gMode++; |
michael@0 | 38 | if (gModes[gMode] != "none") |
michael@0 | 39 | gExpectedId = "p3"; |
michael@0 | 40 | |
michael@0 | 41 | if (gMode != 0) |
michael@0 | 42 | $("l3").setAttribute("closemenu", gModes[gMode]); |
michael@0 | 43 | if (gModes[gMode] == "none") |
michael@0 | 44 | $("l2").open = true; |
michael@0 | 45 | else |
michael@0 | 46 | $("menu").open = true; |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | function executeMenuItem() |
michael@0 | 50 | { |
michael@0 | 51 | synthesizeKey("VK_DOWN", { }); |
michael@0 | 52 | synthesizeKey("VK_RETURN", { }); |
michael@0 | 53 | // after a couple of seconds, end the test, as the 'none' closemenu value |
michael@0 | 54 | // should not hide any popups |
michael@0 | 55 | if (gModes[gMode] == "none") |
michael@0 | 56 | setTimeout(function() { $("menu").open = false; }, 2000); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | function popupHidden(event) |
michael@0 | 60 | { |
michael@0 | 61 | if (gModes[gMode] == "none") { |
michael@0 | 62 | if (event.target.id == "p1") |
michael@0 | 63 | SimpleTest.finish() |
michael@0 | 64 | return; |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | is(event.target.id, gExpectedId, |
michael@0 | 68 | "Expected event " + gModes[gMode] + " " + gExpectedId); |
michael@0 | 69 | |
michael@0 | 70 | gExpectedId = ""; |
michael@0 | 71 | if (event.target.id == "p3") { |
michael@0 | 72 | if (gModes[gMode] == "" || gModes[gMode] == "auto") |
michael@0 | 73 | gExpectedId = "p2"; |
michael@0 | 74 | } |
michael@0 | 75 | else if (event.target.id == "p2") { |
michael@0 | 76 | if (gModes[gMode] == "" || gModes[gMode] == "auto") |
michael@0 | 77 | gExpectedId = "p1"; |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | if (!gExpectedId) |
michael@0 | 81 | nextTest(); |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | ]]> |
michael@0 | 85 | </script> |
michael@0 | 86 | |
michael@0 | 87 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 88 | <p id="display"> |
michael@0 | 89 | </p> |
michael@0 | 90 | <div id="content" style="display: none"> |
michael@0 | 91 | </div> |
michael@0 | 92 | <pre id="test"> |
michael@0 | 93 | </pre> |
michael@0 | 94 | </body> |
michael@0 | 95 | |
michael@0 | 96 | </window> |