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" |
michael@0 | 4 | type="text/css"?> |
michael@0 | 5 | |
michael@0 | 6 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 7 | title="menu tree and events"> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 13 | |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../common.js" /> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../events.js" /> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../role.js" /> |
michael@0 | 20 | |
michael@0 | 21 | <script type="application/javascript"> |
michael@0 | 22 | <![CDATA[ |
michael@0 | 23 | |
michael@0 | 24 | function openMenu(aID, aTree) |
michael@0 | 25 | { |
michael@0 | 26 | this.eventSeq = [ |
michael@0 | 27 | new invokerChecker(EVENT_MENUPOPUP_START, getNode(aID)) |
michael@0 | 28 | ]; |
michael@0 | 29 | |
michael@0 | 30 | this.invoke = function openMenu_invoke() |
michael@0 | 31 | { |
michael@0 | 32 | var button = getNode("button"); |
michael@0 | 33 | getNode(aID).openPopup(button, "after_start", 0, 0, true, false); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | this.finalCheck = function openMenu_finalCheck(aEvent) |
michael@0 | 37 | { |
michael@0 | 38 | testAccessibleTree(aID, aTree); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | this.getID = function openMenu_getID() |
michael@0 | 42 | { |
michael@0 | 43 | return "open menu " + prettyName(aID); |
michael@0 | 44 | } |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | function selectNextMenuItem(aID) |
michael@0 | 48 | { |
michael@0 | 49 | this.eventSeq = [ |
michael@0 | 50 | new invokerChecker(EVENT_FOCUS, getNode(aID)) |
michael@0 | 51 | ]; |
michael@0 | 52 | |
michael@0 | 53 | this.invoke = function selectMenuItem_invoke() |
michael@0 | 54 | { |
michael@0 | 55 | synthesizeKey("VK_DOWN", { }); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | this.getID = function selectMenuItem_getID() |
michael@0 | 59 | { |
michael@0 | 60 | return "select menuitem " + prettyName(aID); |
michael@0 | 61 | } |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | function openSubMenu(aSubMenuID, aItemID, aMenuID, aTree) |
michael@0 | 65 | { |
michael@0 | 66 | this.eventSeq = [ |
michael@0 | 67 | new invokerChecker(EVENT_FOCUS, getNode(aItemID)), |
michael@0 | 68 | ]; |
michael@0 | 69 | |
michael@0 | 70 | this.invoke = function openSubMenu_invoke() |
michael@0 | 71 | { |
michael@0 | 72 | synthesizeKey("VK_RETURN", { }); |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | this.finalCheck = function openSubMenu_finalCheck(aEvent) |
michael@0 | 76 | { |
michael@0 | 77 | testAccessibleTree(aMenuID, aTree); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | this.getID = function openSubMenu_getID() |
michael@0 | 81 | { |
michael@0 | 82 | return "open submenu " + prettyName(aSubMenuID) + " focusing item " + prettyName(aItemID); |
michael@0 | 83 | } |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | function closeSubMenu(aSubMenuID, aItemID) |
michael@0 | 87 | { |
michael@0 | 88 | this.eventSeq = [ |
michael@0 | 89 | new invokerChecker(EVENT_FOCUS, getNode(aItemID)), |
michael@0 | 90 | ]; |
michael@0 | 91 | |
michael@0 | 92 | this.invoke = function closeSubMenu_invoke() |
michael@0 | 93 | { |
michael@0 | 94 | synthesizeKey("VK_ESCAPE", { }); |
michael@0 | 95 | } |
michael@0 | 96 | |
michael@0 | 97 | this.getID = function closeSubMenu_getID() |
michael@0 | 98 | { |
michael@0 | 99 | return "close submenu " + prettyName(aSubMenuID) + " focusing item " + prettyName(aItemID); |
michael@0 | 100 | } |
michael@0 | 101 | } |
michael@0 | 102 | |
michael@0 | 103 | function closeMenu(aID) |
michael@0 | 104 | { |
michael@0 | 105 | this.eventSeq = [ |
michael@0 | 106 | new invokerChecker(EVENT_MENUPOPUP_END, getNode(aID)) |
michael@0 | 107 | ]; |
michael@0 | 108 | |
michael@0 | 109 | this.invoke = function closeMenu_invoke() |
michael@0 | 110 | { |
michael@0 | 111 | synthesizeKey("VK_ESCAPE", { }); |
michael@0 | 112 | } |
michael@0 | 113 | |
michael@0 | 114 | this.getID = function closeMenu_getID() |
michael@0 | 115 | { |
michael@0 | 116 | return "close menu " + prettyName(aID); |
michael@0 | 117 | } |
michael@0 | 118 | } |
michael@0 | 119 | |
michael@0 | 120 | //gA11yEventDumpID = "eventdump"; |
michael@0 | 121 | //gA11yEventDumpToConsole = true; |
michael@0 | 122 | |
michael@0 | 123 | var gQueue = null; |
michael@0 | 124 | var gContextTree = {}; |
michael@0 | 125 | |
michael@0 | 126 | // Linux and Windows menu trees discrepancy: bug 527646. |
michael@0 | 127 | |
michael@0 | 128 | /** |
michael@0 | 129 | * Return the context menu tree before submenus were open. |
michael@0 | 130 | */ |
michael@0 | 131 | function getMenuTree1() |
michael@0 | 132 | { |
michael@0 | 133 | if (LINUX || SOLARIS) { |
michael@0 | 134 | var tree = { |
michael@0 | 135 | role: ROLE_MENUPOPUP, |
michael@0 | 136 | children: [ |
michael@0 | 137 | { |
michael@0 | 138 | name: "item0", |
michael@0 | 139 | role: ROLE_MENUITEM, |
michael@0 | 140 | children: [] |
michael@0 | 141 | }, |
michael@0 | 142 | { |
michael@0 | 143 | name: "item1", |
michael@0 | 144 | role: ROLE_MENUITEM, |
michael@0 | 145 | children: [] |
michael@0 | 146 | }, |
michael@0 | 147 | { |
michael@0 | 148 | name: "item2", |
michael@0 | 149 | role: ROLE_PARENT_MENUITEM, |
michael@0 | 150 | children: [ ] |
michael@0 | 151 | } |
michael@0 | 152 | ] |
michael@0 | 153 | }; |
michael@0 | 154 | return tree; |
michael@0 | 155 | } |
michael@0 | 156 | |
michael@0 | 157 | // Windows |
michael@0 | 158 | var tree = { |
michael@0 | 159 | role: ROLE_MENUPOPUP, |
michael@0 | 160 | children: [ |
michael@0 | 161 | { |
michael@0 | 162 | name: "item0", |
michael@0 | 163 | role: ROLE_MENUITEM, |
michael@0 | 164 | children: [] |
michael@0 | 165 | }, |
michael@0 | 166 | { |
michael@0 | 167 | name: "item1", |
michael@0 | 168 | role: ROLE_MENUITEM, |
michael@0 | 169 | children: [] |
michael@0 | 170 | }, |
michael@0 | 171 | { |
michael@0 | 172 | name: "item2", |
michael@0 | 173 | role: ROLE_PARENT_MENUITEM, |
michael@0 | 174 | children: [ |
michael@0 | 175 | { |
michael@0 | 176 | name: "item2", |
michael@0 | 177 | role: ROLE_MENUPOPUP, |
michael@0 | 178 | children: [ ] |
michael@0 | 179 | } |
michael@0 | 180 | ] |
michael@0 | 181 | } |
michael@0 | 182 | ] |
michael@0 | 183 | }; |
michael@0 | 184 | return tree; |
michael@0 | 185 | } |
michael@0 | 186 | |
michael@0 | 187 | /** |
michael@0 | 188 | * Return context menu tree when submenu was open. |
michael@0 | 189 | */ |
michael@0 | 190 | function getMenuTree2() |
michael@0 | 191 | { |
michael@0 | 192 | var tree = getMenuTree1(); |
michael@0 | 193 | if (LINUX || SOLARIS) { |
michael@0 | 194 | var submenuTree = |
michael@0 | 195 | { |
michael@0 | 196 | name: "item2.0", |
michael@0 | 197 | role: ROLE_PARENT_MENUITEM, |
michael@0 | 198 | children: [ ] |
michael@0 | 199 | }; |
michael@0 | 200 | tree.children[2].children.push(submenuTree); |
michael@0 | 201 | return tree; |
michael@0 | 202 | } |
michael@0 | 203 | |
michael@0 | 204 | // Windows |
michael@0 | 205 | var submenuTree = |
michael@0 | 206 | { |
michael@0 | 207 | name: "item2.0", |
michael@0 | 208 | role: ROLE_PARENT_MENUITEM, |
michael@0 | 209 | children: [ |
michael@0 | 210 | { |
michael@0 | 211 | name: "item2.0", |
michael@0 | 212 | role: ROLE_MENUPOPUP, |
michael@0 | 213 | children: [ ] |
michael@0 | 214 | } |
michael@0 | 215 | ] |
michael@0 | 216 | }; |
michael@0 | 217 | |
michael@0 | 218 | tree.children[2].children[0].children.push(submenuTree); |
michael@0 | 219 | return tree; |
michael@0 | 220 | } |
michael@0 | 221 | |
michael@0 | 222 | /** |
michael@0 | 223 | * Return context menu tree when subsub menu was open. |
michael@0 | 224 | */ |
michael@0 | 225 | function getMenuTree3() |
michael@0 | 226 | { |
michael@0 | 227 | var tree = getMenuTree2(); |
michael@0 | 228 | var subsubmenuTree = |
michael@0 | 229 | { |
michael@0 | 230 | name: "item2.0.0", |
michael@0 | 231 | role: ROLE_MENUITEM, |
michael@0 | 232 | children: [] |
michael@0 | 233 | }; |
michael@0 | 234 | |
michael@0 | 235 | if (LINUX || SOLARIS) |
michael@0 | 236 | tree.children[2].children[0].children.push(subsubmenuTree); |
michael@0 | 237 | else |
michael@0 | 238 | tree.children[2].children[0].children[0].children[0].children.push(subsubmenuTree); |
michael@0 | 239 | |
michael@0 | 240 | return tree; |
michael@0 | 241 | } |
michael@0 | 242 | |
michael@0 | 243 | |
michael@0 | 244 | function doTests() |
michael@0 | 245 | { |
michael@0 | 246 | gQueue = new eventQueue(); |
michael@0 | 247 | |
michael@0 | 248 | // Check initial empty tree |
michael@0 | 249 | testAccessibleTree("context", { MENUPOPUP: [] }); |
michael@0 | 250 | |
michael@0 | 251 | // Open context menu and check that menu item accesibles are created. |
michael@0 | 252 | gQueue.push(new openMenu("context", getMenuTree1())); |
michael@0 | 253 | |
michael@0 | 254 | // Select items and check focus event on them. |
michael@0 | 255 | gQueue.push(new selectNextMenuItem("item0")); |
michael@0 | 256 | gQueue.push(new selectNextMenuItem("item1")); |
michael@0 | 257 | gQueue.push(new selectNextMenuItem("item2")); |
michael@0 | 258 | |
michael@0 | 259 | // Open sub menu and check menu accessible tree and focus event. |
michael@0 | 260 | gQueue.push(new openSubMenu("submenu2", "item2.0", |
michael@0 | 261 | "context", getMenuTree2())); |
michael@0 | 262 | gQueue.push(new openSubMenu("submenu2.0", "item2.0.0", |
michael@0 | 263 | "context", getMenuTree3())); |
michael@0 | 264 | |
michael@0 | 265 | // Close submenus and check that focus goes to parent. |
michael@0 | 266 | gQueue.push(new closeSubMenu("submenu2.0", "item2.0")); |
michael@0 | 267 | gQueue.push(new closeSubMenu("submenu2", "item2")); |
michael@0 | 268 | |
michael@0 | 269 | gQueue.push(new closeMenu("context")); |
michael@0 | 270 | |
michael@0 | 271 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 272 | } |
michael@0 | 273 | |
michael@0 | 274 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 275 | addA11yLoadEvent(doTests); |
michael@0 | 276 | ]]> |
michael@0 | 277 | </script> |
michael@0 | 278 | |
michael@0 | 279 | <hbox flex="1" style="overflow: auto;"> |
michael@0 | 280 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 281 | <a target="_blank" |
michael@0 | 282 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=630194" |
michael@0 | 283 | title="Update accessible tree when opening the menu popup"> |
michael@0 | 284 | Mozilla Bug 630194 |
michael@0 | 285 | </a> |
michael@0 | 286 | <a target="_blank" |
michael@0 | 287 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=630486" |
michael@0 | 288 | title="Don't force accessible creation for popup children."> |
michael@0 | 289 | Mozilla Bug 630486 |
michael@0 | 290 | </a> |
michael@0 | 291 | <p id="display"></p> |
michael@0 | 292 | <div id="content" style="display: none"> |
michael@0 | 293 | </div> |
michael@0 | 294 | <pre id="test"> |
michael@0 | 295 | </pre> |
michael@0 | 296 | </body> |
michael@0 | 297 | |
michael@0 | 298 | <vbox flex="1"> |
michael@0 | 299 | |
michael@0 | 300 | <menupopup id="context"> |
michael@0 | 301 | <menuitem id="item0" label="item0"/> |
michael@0 | 302 | <menuitem id="item1" label="item1"/> |
michael@0 | 303 | <menu id="item2" label="item2"> |
michael@0 | 304 | <menupopup id="submenu2"> |
michael@0 | 305 | <menu id="item2.0" label="item2.0"> |
michael@0 | 306 | <menupopup id="submenu2.0"> |
michael@0 | 307 | <menuitem id="item2.0.0" label="item2.0.0"/> |
michael@0 | 308 | </menupopup> |
michael@0 | 309 | </menu> |
michael@0 | 310 | </menupopup> |
michael@0 | 311 | </menu> |
michael@0 | 312 | </menupopup> |
michael@0 | 313 | |
michael@0 | 314 | <button context="context" id="button">btn</button> |
michael@0 | 315 | |
michael@0 | 316 | <vbox id="eventdump" role="log"/> |
michael@0 | 317 | </vbox> |
michael@0 | 318 | </hbox> |
michael@0 | 319 | </window> |