Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 focus testing"> |
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="../role.js" /> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../states.js" /> |
michael@0 | 20 | <script type="application/javascript" |
michael@0 | 21 | src="../events.js" /> |
michael@0 | 22 | |
michael@0 | 23 | <script type="application/javascript"> |
michael@0 | 24 | //gA11yEventDumpToConsole = true; // debug stuff |
michael@0 | 25 | |
michael@0 | 26 | var gQueue = null; |
michael@0 | 27 | function doTests() |
michael@0 | 28 | { |
michael@0 | 29 | // Test focus events. |
michael@0 | 30 | gQueue = new eventQueue(); |
michael@0 | 31 | |
michael@0 | 32 | if (WIN) { |
michael@0 | 33 | gQueue.push(new toggleTopMenu("fruit", new focusChecker("fruit"))); |
michael@0 | 34 | gQueue.push(new synthRightKey("fruit", new focusChecker("vehicle"))); |
michael@0 | 35 | gQueue.push(new synthEscapeKey("vehicle", new focusChecker(document))); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | // mouse move activate items but no focus event until menubar is active |
michael@0 | 39 | gQueue.push(new synthMouseMove("fruit", new nofocusChecker("apple"))); |
michael@0 | 40 | |
michael@0 | 41 | // mouseover and click on menuitem makes it active before menubar is |
michael@0 | 42 | // active |
michael@0 | 43 | gQueue.push(new synthClick("fruit", new focusChecker("fruit"))); |
michael@0 | 44 | |
michael@0 | 45 | // mouseover on menuitem when menubar is active |
michael@0 | 46 | gQueue.push(new synthMouseMove("apple", new focusChecker("apple"))); |
michael@0 | 47 | |
michael@0 | 48 | // keydown on disabled menuitem (disabled items are skipped on linux) |
michael@0 | 49 | if (WIN) |
michael@0 | 50 | gQueue.push(new synthDownKey("apple", new focusChecker("orange"))); |
michael@0 | 51 | |
michael@0 | 52 | // menu and menuitem are both active |
michael@0 | 53 | // XXX: intermitent failure because two focus events may be coalesced, |
michael@0 | 54 | // think to workaround or fix this issue, when done enable queue invoker |
michael@0 | 55 | // below and remove next two. |
michael@0 | 56 | //gQueue.push(new synthRightKey("apple", |
michael@0 | 57 | // [ new focusChecker("vehicle"), |
michael@0 | 58 | // new focusChecker("cycle")])); |
michael@0 | 59 | gQueue.push(new synthClick("vehicle", new focusChecker("vehicle"))); |
michael@0 | 60 | gQueue.push(new synthDownKey("cycle", new focusChecker("cycle"))); |
michael@0 | 61 | |
michael@0 | 62 | // open submenu |
michael@0 | 63 | gQueue.push(new synthRightKey("cycle", new focusChecker("tricycle"))); |
michael@0 | 64 | |
michael@0 | 65 | // move to first menu in cycle, DOMMenuItemActive is fired for fruit, |
michael@0 | 66 | // cycle and apple menuitems (bug 685191) |
michael@0 | 67 | todo(false, "focus is fired for 'cycle' menuitem"); |
michael@0 | 68 | //gQueue.push(new synthRightKey("vehicle", new focusChecker("apple"))); |
michael@0 | 69 | |
michael@0 | 70 | // click menuitem to close menu, focus gets back to document |
michael@0 | 71 | gQueue.push(new synthClick("tricycle", new focusChecker(document))); |
michael@0 | 72 | |
michael@0 | 73 | //enableLogging("focus,DOMEvents,tree"); // logging for bug708927 |
michael@0 | 74 | //gQueue.onFinish = function() { disableLogging(); } |
michael@0 | 75 | |
michael@0 | 76 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 77 | } |
michael@0 | 78 | |
michael@0 | 79 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 80 | addA11yLoadEvent(doTests); |
michael@0 | 81 | </script> |
michael@0 | 82 | |
michael@0 | 83 | <hbox flex="1" style="overflow: auto;"> |
michael@0 | 84 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 85 | <a target="_blank" |
michael@0 | 86 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958" |
michael@0 | 87 | title="Rework accessible focus handling"> |
michael@0 | 88 | Mozilla Bug 673958 |
michael@0 | 89 | </a> |
michael@0 | 90 | <p id="display"></p> |
michael@0 | 91 | <div id="content" style="display: none"></div> |
michael@0 | 92 | <pre id="test"> |
michael@0 | 93 | </pre> |
michael@0 | 94 | </body> |
michael@0 | 95 | |
michael@0 | 96 | <vbox flex="1"> |
michael@0 | 97 | <menubar> |
michael@0 | 98 | <menu id="fruit" label="Fruit"> |
michael@0 | 99 | <menupopup> |
michael@0 | 100 | <menuitem id="apple" label="Apple"/> |
michael@0 | 101 | <menuitem id="orange" label="Orange" disabled="true"/> |
michael@0 | 102 | </menupopup> |
michael@0 | 103 | </menu> |
michael@0 | 104 | <menu id="vehicle" label="Vehicle"> |
michael@0 | 105 | <menupopup> |
michael@0 | 106 | <menu id="cycle" label="cycle"> |
michael@0 | 107 | <menupopup> |
michael@0 | 108 | <menuitem id="tricycle" label="tricycle"/> |
michael@0 | 109 | </menupopup> |
michael@0 | 110 | </menu> |
michael@0 | 111 | <menuitem id="car" label="Car" disabled="true"/> |
michael@0 | 112 | </menupopup> |
michael@0 | 113 | </menu> |
michael@0 | 114 | </menubar> |
michael@0 | 115 | |
michael@0 | 116 | <vbox id="eventdump"/> |
michael@0 | 117 | </vbox> |
michael@0 | 118 | </hbox> |
michael@0 | 119 | </window> |