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.
1 <html>
3 <head>
4 <title>Context menu tests</title>
6 <link rel="stylesheet" type="text/css"
7 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
9 <script type="application/javascript"
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
11 <script type="application/javascript"
12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
14 <script type="application/javascript"
15 src="../common.js"></script>
16 <script type="application/javascript"
17 src="../role.js"></script>
18 <script type="application/javascript"
19 src="../states.js"></script>
20 <script type="application/javascript"
21 src="../events.js"></script>
23 <script type="application/javascript">
24 ////////////////////////////////////////////////////////////////////////////
25 // Invokers
27 function showContextMenu(aID)
28 {
29 this.DOMNode = getNode(aID);
31 this.eventSeq = [
32 new invokerChecker(EVENT_MENUPOPUP_START, getContextMenuNode()),
33 ];
35 this.invoke = function showContextMenu_invoke()
36 {
37 synthesizeMouse(this.DOMNode, 4, 4, { type: "contextmenu", button: 2 });
38 }
40 this.getID = function showContextMenu_getID()
41 {
42 return "show context menu";
43 }
44 }
46 function selectMenuItem()
47 {
48 this.eventSeq = [
49 new invokerChecker(EVENT_FOCUS, getFocusedMenuItem)
50 ];
52 this.invoke = function selectMenuItem_invoke()
53 {
54 synthesizeKey("VK_DOWN", { });
55 }
57 this.getID = function selectMenuItem_getID()
58 {
59 return "select first menuitem";
60 }
61 }
63 function closeContextMenu(aID)
64 {
65 this.eventSeq = [
66 new invokerChecker(EVENT_MENUPOPUP_END,
67 getAccessible(getContextMenuNode()))
68 ];
70 this.invoke = function closeContextMenu_invoke()
71 {
72 synthesizeKey("VK_ESCAPE", { });
73 }
75 this.getID = function closeContextMenu_getID()
76 {
77 return "close context menu";
78 }
79 }
81 function getContextMenuNode()
82 {
83 return getRootAccessible().DOMDocument.
84 getElementById("contentAreaContextMenu");
85 }
87 function getFocusedMenuItem()
88 {
89 var menu = getAccessible(getAccessible(getContextMenuNode()));
90 for (var idx = 0; idx < menu.childCount; idx++) {
91 var item = menu.getChildAt(idx);
93 if (hasState(item, STATE_FOCUSED))
94 return getAccessible(item);
95 }
96 return null;
97 }
99 ////////////////////////////////////////////////////////////////////////////
100 // Do tests
102 var gQueue = null;
103 //gA11yEventDumpID = "eventdump"; // debug stuff
104 //gA11yEventDumpToConsole = true;
106 function doTests()
107 {
108 gQueue = new eventQueue();
110 gQueue.push(new showContextMenu("input"));
111 gQueue.push(new selectMenuItem());
112 gQueue.push(new closeContextMenu());
114 gQueue.invoke(); // Will call SimpleTest.finish();
115 }
117 SimpleTest.waitForExplicitFinish();
118 addA11yLoadEvent(doTests);
119 </script>
120 </head>
122 <body>
124 <a target="_blank"
125 href="https://bugzilla.mozilla.org/show_bug.cgi?id=580535"
126 title="Broken accessibility in context menus">
127 Mozilla Bug 580535
128 </a><br>
130 <p id="display"></p>
131 <div id="content" style="display: none"></div>
132 <pre id="test">
133 </pre>
135 <input id="input">
137 <div id="eventdump"></div>
138 </body>
139 </html>