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>Accessible focus 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="../events.js"></script> |
michael@0 | 20 | <script type="application/javascript" |
michael@0 | 21 | src="../states.js"></script> |
michael@0 | 22 | |
michael@0 | 23 | <script type="application/javascript"> |
michael@0 | 24 | function focusElmWhileSubdocIsFocused(aID) |
michael@0 | 25 | { |
michael@0 | 26 | this.DOMNode = getNode(aID); |
michael@0 | 27 | |
michael@0 | 28 | this.invoke = function focusElmWhileSubdocIsFocused_invoke() |
michael@0 | 29 | { |
michael@0 | 30 | this.DOMNode.focus(); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | this.eventSeq = [ |
michael@0 | 34 | new focusChecker(this.DOMNode) |
michael@0 | 35 | ]; |
michael@0 | 36 | |
michael@0 | 37 | this.unexpectedEventSeq = [ |
michael@0 | 38 | new invokerChecker(EVENT_FOCUS, this.DOMNode.ownerDocument) |
michael@0 | 39 | ]; |
michael@0 | 40 | |
michael@0 | 41 | this.getID = function focusElmWhileSubdocIsFocused_getID() |
michael@0 | 42 | { |
michael@0 | 43 | return "Focus element while subdocument is focused " + prettyName(aID); |
michael@0 | 44 | } |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | function imageMapChecker(aID) |
michael@0 | 48 | { |
michael@0 | 49 | var node = getNode(aID); |
michael@0 | 50 | this.type = EVENT_FOCUS; |
michael@0 | 51 | this.match = function imageMapChecker_match(aEvent) |
michael@0 | 52 | { |
michael@0 | 53 | return aEvent.DOMNode == node; |
michael@0 | 54 | } |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | function topMenuChecker() |
michael@0 | 58 | { |
michael@0 | 59 | this.type = EVENT_FOCUS; |
michael@0 | 60 | this.match = function topMenuChecker_match(aEvent) |
michael@0 | 61 | { |
michael@0 | 62 | return aEvent.accessible.role == ROLE_PARENT_MENUITEM; |
michael@0 | 63 | } |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | function contextMenuChecker() |
michael@0 | 67 | { |
michael@0 | 68 | this.type = EVENT_MENUPOPUP_START; |
michael@0 | 69 | this.match = function contextMenuChecker_match(aEvent) |
michael@0 | 70 | { |
michael@0 | 71 | return aEvent.accessible.role == ROLE_MENUPOPUP; |
michael@0 | 72 | } |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | function focusContextMenuItemChecker() |
michael@0 | 76 | { |
michael@0 | 77 | this.__proto__ = new focusChecker(); |
michael@0 | 78 | |
michael@0 | 79 | this.match = function focusContextMenuItemChecker_match(aEvent) |
michael@0 | 80 | { |
michael@0 | 81 | return aEvent.accessible.role == ROLE_MENUITEM; |
michael@0 | 82 | } |
michael@0 | 83 | } |
michael@0 | 84 | |
michael@0 | 85 | /** |
michael@0 | 86 | * Do tests. |
michael@0 | 87 | */ |
michael@0 | 88 | |
michael@0 | 89 | //gA11yEventDumpID = "eventdump"; // debug stuff |
michael@0 | 90 | //gA11yEventDumpToConsole = true; |
michael@0 | 91 | |
michael@0 | 92 | var gQueue = null; |
michael@0 | 93 | |
michael@0 | 94 | function doTests() |
michael@0 | 95 | { |
michael@0 | 96 | var frameDoc = document.getElementById("iframe").contentDocument; |
michael@0 | 97 | |
michael@0 | 98 | var editableDoc = document.getElementById('editabledoc').contentDocument; |
michael@0 | 99 | editableDoc.designMode = 'on'; |
michael@0 | 100 | |
michael@0 | 101 | gQueue = new eventQueue(); |
michael@0 | 102 | |
michael@0 | 103 | gQueue.push(new synthFocus("editablearea")); |
michael@0 | 104 | gQueue.push(new synthFocus("navarea")); |
michael@0 | 105 | gQueue.push(new synthTab("navarea", new focusChecker(frameDoc))); |
michael@0 | 106 | gQueue.push(new focusElmWhileSubdocIsFocused("link")); |
michael@0 | 107 | |
michael@0 | 108 | gQueue.push(new synthTab(editableDoc, new focusChecker(editableDoc))); |
michael@0 | 109 | if (WIN || LINUX) { |
michael@0 | 110 | // Alt key is used to active menubar and focus menu item on Windows, |
michael@0 | 111 | // other platforms requires setting a ui.key.menuAccessKeyFocuses |
michael@0 | 112 | // preference. |
michael@0 | 113 | gQueue.push(new toggleTopMenu(editableDoc, new topMenuChecker())); |
michael@0 | 114 | gQueue.push(new toggleTopMenu(editableDoc, new focusChecker(editableDoc))); |
michael@0 | 115 | } |
michael@0 | 116 | gQueue.push(new synthContextMenu(editableDoc, new contextMenuChecker())); |
michael@0 | 117 | gQueue.push(new synthDownKey(editableDoc, new focusContextMenuItemChecker())); |
michael@0 | 118 | gQueue.push(new synthEscapeKey(editableDoc, new focusChecker(editableDoc))); |
michael@0 | 119 | if (SEAMONKEY) { |
michael@0 | 120 | todo(false, "shift tab from editable document fails on (Windows) SeaMonkey! (Bug 718235)"); |
michael@0 | 121 | } else { |
michael@0 | 122 | if (LINUX || MAC) |
michael@0 | 123 | todo(false, "shift tab from editable document fails on linux and Mac, bug 746519!"); |
michael@0 | 124 | else |
michael@0 | 125 | gQueue.push(new synthShiftTab("link", new focusChecker("link"))); |
michael@0 | 126 | } // ! SEAMONKEY |
michael@0 | 127 | |
michael@0 | 128 | gQueue.push(new synthFocus("a", new imageMapChecker("a"))); |
michael@0 | 129 | gQueue.push(new synthFocus("b", new imageMapChecker("b"))); |
michael@0 | 130 | |
michael@0 | 131 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 132 | } |
michael@0 | 133 | |
michael@0 | 134 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 135 | addA11yLoadEvent(doTests); |
michael@0 | 136 | </script> |
michael@0 | 137 | </head> |
michael@0 | 138 | |
michael@0 | 139 | <body> |
michael@0 | 140 | <a target="_blank" |
michael@0 | 141 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=352220" |
michael@0 | 142 | title="Inconsistent focus events when returning to a document frame"> |
michael@0 | 143 | Mozilla Bug 352220 |
michael@0 | 144 | </a> |
michael@0 | 145 | <a target="_blank" |
michael@0 | 146 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=550338" |
michael@0 | 147 | title="Broken focus when returning to editable documents from menus"> |
michael@0 | 148 | Mozilla Bug 550338 |
michael@0 | 149 | </a> |
michael@0 | 150 | <a target="_blank" |
michael@0 | 151 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958" |
michael@0 | 152 | title="Rework accessible focus handling"> |
michael@0 | 153 | Mozilla Bug 673958 |
michael@0 | 154 | </a> |
michael@0 | 155 | <a target="_blank" |
michael@0 | 156 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=961696" |
michael@0 | 157 | title="Accessible object:state-changed:focused events for imagemap links are broken"> |
michael@0 | 158 | Mozilla Bug 961696 |
michael@0 | 159 | </a> |
michael@0 | 160 | <p id="display"></p> |
michael@0 | 161 | <div id="content" style="display: none"></div> |
michael@0 | 162 | <pre id="test"> |
michael@0 | 163 | </pre> |
michael@0 | 164 | |
michael@0 | 165 | <div id="editablearea" contentEditable="true">editable area</div> |
michael@0 | 166 | <div id="navarea" tabindex="0">navigable area</div> |
michael@0 | 167 | <iframe id="iframe" src="data:text/html,<html></html>"></iframe> |
michael@0 | 168 | <a id="link" href="">link</a> |
michael@0 | 169 | <iframe id="editabledoc" src="about:blank"></iframe> |
michael@0 | 170 | |
michael@0 | 171 | <map name="atoz_map"> |
michael@0 | 172 | <area id="a" coords="0,0,13,14" shape="rect"> |
michael@0 | 173 | <area id="b" coords="17,0,30,14" shape="rect"> |
michael@0 | 174 | </map> |
michael@0 | 175 | <img width="447" height="15" usemap="#atoz_map" src="../letters.gif"> |
michael@0 | 176 | |
michael@0 | 177 | <div id="eventdump"></div> |
michael@0 | 178 | </body> |
michael@0 | 179 | </html> |