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 | <html> |
michael@0 | 2 | |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>ARIA menu events testing</title> |
michael@0 | 5 | |
michael@0 | 6 | <link rel="stylesheet" type="text/css" |
michael@0 | 7 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 13 | |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../common.js"></script> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../role.js"></script> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../states.js"></script> |
michael@0 | 20 | <script type="application/javascript" |
michael@0 | 21 | src="../events.js"></script> |
michael@0 | 22 | |
michael@0 | 23 | <script type="application/javascript"> |
michael@0 | 24 | const kViaDisplayStyle = 0; |
michael@0 | 25 | const kViaVisibilityStyle = 1; |
michael@0 | 26 | |
michael@0 | 27 | function focusMenu(aMenuBarID, aMenuID, aActiveMenuBarID) |
michael@0 | 28 | { |
michael@0 | 29 | this.eventSeq = []; |
michael@0 | 30 | |
michael@0 | 31 | if (aActiveMenuBarID) { |
michael@0 | 32 | this.eventSeq.push(new invokerChecker(EVENT_MENU_END, |
michael@0 | 33 | getNode(aActiveMenuBarID))); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | this.eventSeq.push(new invokerChecker(EVENT_MENU_START, getNode(aMenuBarID))); |
michael@0 | 37 | this.eventSeq.push(new invokerChecker(EVENT_FOCUS, getNode(aMenuID))); |
michael@0 | 38 | |
michael@0 | 39 | this.invoke = function focusMenu_invoke() |
michael@0 | 40 | { |
michael@0 | 41 | getNode(aMenuID).focus(); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | this.getID = function focusMenu_getID() |
michael@0 | 45 | { |
michael@0 | 46 | return "focus menu '" + aMenuID + "'"; |
michael@0 | 47 | } |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | function showMenu(aMenuID, aParentMenuID, aHow) |
michael@0 | 51 | { |
michael@0 | 52 | this.menuNode = getNode(aMenuID); |
michael@0 | 53 | |
michael@0 | 54 | this.eventSeq = [ |
michael@0 | 55 | new invokerChecker(EVENT_SHOW, this.menuNode), |
michael@0 | 56 | new invokerChecker(EVENT_MENUPOPUP_START, this.menuNode), |
michael@0 | 57 | new invokerChecker(EVENT_REORDER, getNode(aParentMenuID)) |
michael@0 | 58 | ]; |
michael@0 | 59 | |
michael@0 | 60 | this.invoke = function showMenu_invoke() |
michael@0 | 61 | { |
michael@0 | 62 | if (aHow == kViaDisplayStyle) |
michael@0 | 63 | this.menuNode.style.display = "block"; |
michael@0 | 64 | else |
michael@0 | 65 | this.menuNode.style.visibility = "visible"; |
michael@0 | 66 | }; |
michael@0 | 67 | |
michael@0 | 68 | this.getID = function showMenu_getID() |
michael@0 | 69 | { |
michael@0 | 70 | return "Show ARIA menu '" + aMenuID + "' by " + |
michael@0 | 71 | (aHow == kViaDisplayStyle ? "display" : "visibility") + |
michael@0 | 72 | " style tricks"; |
michael@0 | 73 | }; |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | function closeMenu(aMenuID, aParentMenuID, aHow) |
michael@0 | 77 | { |
michael@0 | 78 | this.menuNode = getNode(aMenuID); |
michael@0 | 79 | this.menu = null; |
michael@0 | 80 | |
michael@0 | 81 | this.eventSeq = [ |
michael@0 | 82 | new invokerChecker(EVENT_MENUPOPUP_END, getMenu, this), |
michael@0 | 83 | new invokerChecker(EVENT_HIDE, getMenu, this), |
michael@0 | 84 | new invokerChecker(EVENT_REORDER, getNode(aParentMenuID)) |
michael@0 | 85 | ]; |
michael@0 | 86 | |
michael@0 | 87 | this.invoke = function closeMenu_invoke() |
michael@0 | 88 | { |
michael@0 | 89 | // Store menu accessible reference while menu is still open. |
michael@0 | 90 | this.menu = getAccessible(this.menuNode); |
michael@0 | 91 | |
michael@0 | 92 | // Hide menu. |
michael@0 | 93 | if (aHow == kViaDisplayStyle) |
michael@0 | 94 | this.menuNode.style.display = "none"; |
michael@0 | 95 | else |
michael@0 | 96 | this.menuNode.style.visibility = "hidden"; |
michael@0 | 97 | } |
michael@0 | 98 | |
michael@0 | 99 | this.getID = function closeMenu_getID() |
michael@0 | 100 | { |
michael@0 | 101 | return "Close ARIA menu " + aMenuID + " by " + |
michael@0 | 102 | (aHow == kViaDisplayStyle ? "display" : "visibility") + |
michael@0 | 103 | " style tricks"; |
michael@0 | 104 | } |
michael@0 | 105 | |
michael@0 | 106 | function getMenu(aThisObj) |
michael@0 | 107 | { |
michael@0 | 108 | return aThisObj.menu; |
michael@0 | 109 | } |
michael@0 | 110 | } |
michael@0 | 111 | |
michael@0 | 112 | function focusInsideMenu(aMenuID, aMenuBarID) |
michael@0 | 113 | { |
michael@0 | 114 | this.eventSeq = [ |
michael@0 | 115 | new invokerChecker(EVENT_FOCUS, getNode(aMenuID)) |
michael@0 | 116 | ]; |
michael@0 | 117 | |
michael@0 | 118 | this.unexpectedEventSeq = [ |
michael@0 | 119 | new invokerChecker(EVENT_MENU_END, getNode(aMenuBarID)) |
michael@0 | 120 | ]; |
michael@0 | 121 | |
michael@0 | 122 | this.invoke = function focusInsideMenu_invoke() |
michael@0 | 123 | { |
michael@0 | 124 | getNode(aMenuID).focus(); |
michael@0 | 125 | } |
michael@0 | 126 | |
michael@0 | 127 | this.getID = function focusInsideMenu_getID() |
michael@0 | 128 | { |
michael@0 | 129 | return "focus menu '" + aMenuID + "'"; |
michael@0 | 130 | } |
michael@0 | 131 | } |
michael@0 | 132 | |
michael@0 | 133 | function blurMenu(aMenuBarID) |
michael@0 | 134 | { |
michael@0 | 135 | var eventSeq = [ |
michael@0 | 136 | new invokerChecker(EVENT_MENU_END, getNode(aMenuBarID)), |
michael@0 | 137 | new invokerChecker(EVENT_FOCUS, getNode("outsidemenu")) |
michael@0 | 138 | ]; |
michael@0 | 139 | |
michael@0 | 140 | this.__proto__ = new synthClick("outsidemenu", eventSeq); |
michael@0 | 141 | |
michael@0 | 142 | this.getID = function blurMenu_getID() |
michael@0 | 143 | { |
michael@0 | 144 | return "blur menu"; |
michael@0 | 145 | } |
michael@0 | 146 | } |
michael@0 | 147 | |
michael@0 | 148 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 149 | // Do tests |
michael@0 | 150 | |
michael@0 | 151 | var gQueue = null; |
michael@0 | 152 | |
michael@0 | 153 | //gA11yEventDumpToConsole = true; // debuging |
michael@0 | 154 | |
michael@0 | 155 | function doTests() |
michael@0 | 156 | { |
michael@0 | 157 | gQueue = new eventQueue(); |
michael@0 | 158 | |
michael@0 | 159 | gQueue.push(new focusMenu("menubar2", "menu-help")); |
michael@0 | 160 | gQueue.push(new focusMenu("menubar", "menu-file", "menubar2")); |
michael@0 | 161 | gQueue.push(new showMenu("menupopup-file", "menu-file", kViaDisplayStyle)); |
michael@0 | 162 | gQueue.push(new closeMenu("menupopup-file", "menu-file", kViaDisplayStyle)); |
michael@0 | 163 | gQueue.push(new showMenu("menupopup-edit", "menu-edit", kViaVisibilityStyle)); |
michael@0 | 164 | gQueue.push(new closeMenu("menupopup-edit", "menu-edit", kViaVisibilityStyle)); |
michael@0 | 165 | gQueue.push(new focusInsideMenu("menu-edit", "menubar")); |
michael@0 | 166 | gQueue.push(new blurMenu("menubar")); |
michael@0 | 167 | |
michael@0 | 168 | gQueue.push(new focusMenu("menubar3", "mb3-mi-outside")); |
michael@0 | 169 | gQueue.push(new showMenu("mb4-menu", document, kViaDisplayStyle)); |
michael@0 | 170 | gQueue.push(new focusMenu("menubar4", "mb4-item1")); |
michael@0 | 171 | gQueue.push(new focusMenu("menubar5", "mb5-mi")); |
michael@0 | 172 | |
michael@0 | 173 | gQueue.push(new synthFocus("mi6")); |
michael@0 | 174 | |
michael@0 | 175 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 176 | } |
michael@0 | 177 | |
michael@0 | 178 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 179 | addA11yLoadEvent(doTests); |
michael@0 | 180 | </script> |
michael@0 | 181 | </head> |
michael@0 | 182 | |
michael@0 | 183 | <body> |
michael@0 | 184 | |
michael@0 | 185 | <a target="_blank" |
michael@0 | 186 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=606207" |
michael@0 | 187 | title="Dojo dropdown buttons are broken"> |
michael@0 | 188 | Bug 606207 |
michael@0 | 189 | </a> |
michael@0 | 190 | <a target="_blank" |
michael@0 | 191 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=614829" |
michael@0 | 192 | title="Menupopup end event isn't fired for ARIA menus"> |
michael@0 | 193 | Bug 614829 |
michael@0 | 194 | </a> |
michael@0 | 195 | <a target="_blank" |
michael@0 | 196 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=615189" |
michael@0 | 197 | title="Clean up FireAccessibleFocusEvent"> |
michael@0 | 198 | Bug 615189 |
michael@0 | 199 | </a> |
michael@0 | 200 | <a target="_blank" |
michael@0 | 201 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958" |
michael@0 | 202 | title="Rework accessible focus handling"> |
michael@0 | 203 | Bug 673958 |
michael@0 | 204 | </a> |
michael@0 | 205 | <a target="_blank" |
michael@0 | 206 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=933322" |
michael@0 | 207 | title="menustart/end events are missing when aria-owns makes a menu hierarchy"> |
michael@0 | 208 | Bug 933322 |
michael@0 | 209 | </a> |
michael@0 | 210 | <a target="_blank" |
michael@0 | 211 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=934460" |
michael@0 | 212 | title="menustart/end events may be missed when top level menuitem is focused"> |
michael@0 | 213 | Bug 934460 |
michael@0 | 214 | </a> |
michael@0 | 215 | <a target="_blank" |
michael@0 | 216 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=970005" |
michael@0 | 217 | title="infinite long loop in a11y:FocusManager::ProcessFocusEvent"> |
michael@0 | 218 | Bug 970005 |
michael@0 | 219 | </a> |
michael@0 | 220 | |
michael@0 | 221 | <p id="display"></p> |
michael@0 | 222 | <div id="content" style="display: none"></div> |
michael@0 | 223 | <pre id="test"> |
michael@0 | 224 | </pre> |
michael@0 | 225 | |
michael@0 | 226 | <div id="menubar" role="menubar"> |
michael@0 | 227 | <div id="menu-file" role="menuitem" tabindex="0"> |
michael@0 | 228 | File |
michael@0 | 229 | <div id="menupopup-file" role="menu" style="display: none;"> |
michael@0 | 230 | <div id="menuitem-newtab" role="menuitem" tabindex="0">New Tab</div> |
michael@0 | 231 | <div id="menuitem-newwindow" role="menuitem" tabindex="0">New Window</div> |
michael@0 | 232 | </div> |
michael@0 | 233 | </div> |
michael@0 | 234 | <div id="menu-edit" role="menuitem" tabindex="0"> |
michael@0 | 235 | Edit |
michael@0 | 236 | <div id="menupopup-edit" role="menu" style="visibility: hidden;"> |
michael@0 | 237 | <div id="menuitem-undo" role="menuitem" tabindex="0">Undo</div> |
michael@0 | 238 | <div id="menuitem-redo" role="menuitem" tabindex="0">Redo</div> |
michael@0 | 239 | </div> |
michael@0 | 240 | </div> |
michael@0 | 241 | </div> |
michael@0 | 242 | <div id="menubar2" role="menubar"> |
michael@0 | 243 | <div id="menu-help" role="menuitem" tabindex="0"> |
michael@0 | 244 | Help |
michael@0 | 245 | <div id="menupopup-help" role="menu" style="display: none;"> |
michael@0 | 246 | <div id="menuitem-about" role="menuitem" tabindex="0">About</div> |
michael@0 | 247 | </div> |
michael@0 | 248 | </div> |
michael@0 | 249 | </div> |
michael@0 | 250 | <div tabindex="0" id="outsidemenu">outsidemenu</div> |
michael@0 | 251 | |
michael@0 | 252 | <!-- aria-owns relations --> |
michael@0 | 253 | <div id="menubar3" role="menubar" aria-owns="mb3-mi-outside"></div> |
michael@0 | 254 | <div id="mb3-mi-outside" role="menuitem" tabindex="0">Outside</div> |
michael@0 | 255 | |
michael@0 | 256 | <div id="menubar4" role="menubar"> |
michael@0 | 257 | <div role="menuitem" aria-haspopup="true" aria-owns="mb4-menu">Item</div> |
michael@0 | 258 | </div> |
michael@0 | 259 | <div id="mb4-menu" role="menu" style="display:none;"> |
michael@0 | 260 | <div role="menuitem" id="mb4-item1" tabindex="0">Item 1.1</div> |
michael@0 | 261 | <div role="menuitem" tabindex="0">Item 1.2</div> |
michael@0 | 262 | </div> |
michael@0 | 263 | |
michael@0 | 264 | <!-- focus top-level menu item having haspopup --> |
michael@0 | 265 | <div id="menubar5" role="menubar"> |
michael@0 | 266 | <div role="menuitem" aria-haspopup="true" id="mb5-mi" tabindex="0"> |
michael@0 | 267 | Item |
michael@0 | 268 | <div role="menu" style="display:none;"> |
michael@0 | 269 | <div role="menuitem" tabindex="0">Item 1.1</div> |
michael@0 | 270 | <div role="menuitem" tabindex="0">Item 1.2</div> |
michael@0 | 271 | </div> |
michael@0 | 272 | </div> |
michael@0 | 273 | </div> |
michael@0 | 274 | |
michael@0 | 275 | <!-- other aria-owns relations --> |
michael@0 | 276 | <div id="mi6" tabindex="0" role="menuitem">aria-owned item</div> |
michael@0 | 277 | <div aria-owns="mi6">Obla</div> |
michael@0 | 278 | |
michael@0 | 279 | <div id="eventdump"></div> |
michael@0 | 280 | |
michael@0 | 281 | </body> |
michael@0 | 282 | </html> |