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="Open panel from menuitem" |
michael@0 | 6 | onload="setTimeout(runTests, 0);" |
michael@0 | 7 | xmlns:html="http://www.w3.org/1999/xhtml" |
michael@0 | 8 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 9 | |
michael@0 | 10 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 12 | |
michael@0 | 13 | <!-- |
michael@0 | 14 | This test does the following: |
michael@0 | 15 | 1. Opens the menu, causing the popupshown event to fire, which will call menuOpened. |
michael@0 | 16 | 2. Keyboard events are fired to cause the first item on the menu to be executed. |
michael@0 | 17 | 3. The command event handler for the first menuitem opens the panel. |
michael@0 | 18 | 4. As a menuitem was executed, the menu will roll up, hiding it. |
michael@0 | 19 | 5. The popuphidden event for the menu calls menuClosed which tests the popup states. |
michael@0 | 20 | 6. The panelOpened function tests the popup states again and hides the popup. |
michael@0 | 21 | 7. Once the panel's popuphidden event fires, tests are performed to see if |
michael@0 | 22 | panels inside buttons and toolbarbuttons work. Each is opened and the closed. |
michael@0 | 23 | --> |
michael@0 | 24 | |
michael@0 | 25 | <menu id="menu" onpopupshown="menuOpened()" onpopuphidden="menuClosed();"> |
michael@0 | 26 | <menupopup> |
michael@0 | 27 | <menuitem id="i1" label="One" oncommand="$('panel').openPopup($('menu'), 'after_start');"/> |
michael@0 | 28 | <menuitem id="i2" label="Two"/> |
michael@0 | 29 | </menupopup> |
michael@0 | 30 | </menu> |
michael@0 | 31 | |
michael@0 | 32 | <panel id="hiddenpanel" hidden="true"/> |
michael@0 | 33 | |
michael@0 | 34 | <panel id="panel" onpopupshown="panelOpened()" |
michael@0 | 35 | onpopuphidden="$('button').focus(); $('button').open = true"> |
michael@0 | 36 | <textbox/> |
michael@0 | 37 | </panel> |
michael@0 | 38 | |
michael@0 | 39 | <button id="button" type="panel" label="Button"> |
michael@0 | 40 | <panel onpopupshown="panelOnButtonOpened(this)" |
michael@0 | 41 | onpopuphidden="$('tbutton').open = true;"> |
michael@0 | 42 | <button label="OK" oncommand="this.parentNode.parentNode.open = false"/> |
michael@0 | 43 | </panel> |
michael@0 | 44 | </button> |
michael@0 | 45 | |
michael@0 | 46 | <toolbarbutton id="tbutton" type="panel" label="Toolbarbutton"> |
michael@0 | 47 | <panel onpopupshown="panelOnToolbarbuttonOpened(this)" |
michael@0 | 48 | onpopuphidden="SimpleTest.finish()"> |
michael@0 | 49 | <textbox/> |
michael@0 | 50 | </panel> |
michael@0 | 51 | </toolbarbutton> |
michael@0 | 52 | |
michael@0 | 53 | <script class="testbody" type="application/javascript"> |
michael@0 | 54 | <![CDATA[ |
michael@0 | 55 | |
michael@0 | 56 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 57 | |
michael@0 | 58 | function runTests() |
michael@0 | 59 | { |
michael@0 | 60 | is($("hiddenpanel").state, "closed", "hidden popup is closed"); |
michael@0 | 61 | |
michael@0 | 62 | var menu = $("menu"); |
michael@0 | 63 | menu.open = true; |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | function menuOpened() |
michael@0 | 67 | { |
michael@0 | 68 | synthesizeKey("VK_DOWN", { }); |
michael@0 | 69 | synthesizeKey("VK_RETURN", { }); |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | function menuClosed() |
michael@0 | 73 | { |
michael@0 | 74 | // the panel will be open at this point, but the popupshown event |
michael@0 | 75 | // still needs to fire |
michael@0 | 76 | is($("panel").state, "showing", "panel is open after menu hide"); |
michael@0 | 77 | is($("menu").firstChild.state, "closed", "menu is closed after menu hide"); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | function panelOpened() |
michael@0 | 81 | { |
michael@0 | 82 | is($("panel").state, "open", "panel is open"); |
michael@0 | 83 | is($("menu").firstChild.state, "closed", "menu is closed"); |
michael@0 | 84 | $("panel").hidePopup(); |
michael@0 | 85 | } |
michael@0 | 86 | |
michael@0 | 87 | function panelOnButtonOpened(panel) |
michael@0 | 88 | { |
michael@0 | 89 | is(panel.state, 'open', 'button panel is open'); |
michael@0 | 90 | is(document.activeElement, document.documentElement, "focus blurred on panel from button open"); |
michael@0 | 91 | synthesizeKey("VK_DOWN", { }); |
michael@0 | 92 | is(document.activeElement, document.documentElement, "focus not modified on cursor down from button"); |
michael@0 | 93 | panel.firstChild.doCommand() |
michael@0 | 94 | } |
michael@0 | 95 | |
michael@0 | 96 | function panelOnToolbarbuttonOpened(panel) |
michael@0 | 97 | { |
michael@0 | 98 | is(panel.state, 'open', 'toolbarbutton panel is open'); |
michael@0 | 99 | is(document.activeElement, document.documentElement, "focus blurred on panel from toolbarbutton open"); |
michael@0 | 100 | panel.firstChild.focus(); |
michael@0 | 101 | synthesizeKey("VK_DOWN", { }); |
michael@0 | 102 | is(document.activeElement, panel.firstChild.inputField, "focus not modified on cursor down from toolbarbutton"); |
michael@0 | 103 | panel.parentNode.open = false; |
michael@0 | 104 | } |
michael@0 | 105 | |
michael@0 | 106 | ]]> |
michael@0 | 107 | </script> |
michael@0 | 108 | |
michael@0 | 109 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 110 | <p id="display"> |
michael@0 | 111 | </p> |
michael@0 | 112 | <div id="content" style="display: none"> |
michael@0 | 113 | </div> |
michael@0 | 114 | <pre id="test"> |
michael@0 | 115 | </pre> |
michael@0 | 116 | </body> |
michael@0 | 117 | |
michael@0 | 118 | </window> |