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 | <html> |
michael@0 | 2 | |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>nsIAccessible::takeFocus 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 | |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="../common.js"></script> |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../role.js"></script> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../states.js"></script> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../events.js"></script> |
michael@0 | 20 | |
michael@0 | 21 | <script type="application/javascript"> |
michael@0 | 22 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 23 | // Invokers |
michael@0 | 24 | |
michael@0 | 25 | function takeFocusInvoker(aID) |
michael@0 | 26 | { |
michael@0 | 27 | this.accessible = getAccessible(aID); |
michael@0 | 28 | |
michael@0 | 29 | this.eventSeq = [ new focusChecker(this.accessible) ]; |
michael@0 | 30 | |
michael@0 | 31 | this.invoke = function takeFocusInvoker_invoke() |
michael@0 | 32 | { |
michael@0 | 33 | this.accessible.takeFocus(); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | this.getID = function takeFocusInvoker_getID() |
michael@0 | 37 | { |
michael@0 | 38 | return "takeFocus for " + prettyName(aID); |
michael@0 | 39 | } |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 43 | // Test |
michael@0 | 44 | |
michael@0 | 45 | //gA11yEventDumpToConsole = true; // debug stuff |
michael@0 | 46 | |
michael@0 | 47 | var gQueue = null; |
michael@0 | 48 | function doTest() |
michael@0 | 49 | { |
michael@0 | 50 | disableLogging(); // from test_focusedChild |
michael@0 | 51 | gQueue = new eventQueue(); |
michael@0 | 52 | |
michael@0 | 53 | gQueue.push(new takeFocusInvoker("aria-link")); |
michael@0 | 54 | gQueue.push(new takeFocusInvoker("aria-link2")); |
michael@0 | 55 | gQueue.push(new takeFocusInvoker("link")); |
michael@0 | 56 | gQueue.push(new takeFocusInvoker("item2")); |
michael@0 | 57 | gQueue.push(new takeFocusInvoker("plugin")); |
michael@0 | 58 | gQueue.push(new takeFocusInvoker(document)); |
michael@0 | 59 | gQueue.push(new takeFocusInvoker("lb_item2")); |
michael@0 | 60 | gQueue.push(new takeFocusInvoker(document)); |
michael@0 | 61 | gQueue.push(new takeFocusInvoker("lb_item3.2")); |
michael@0 | 62 | gQueue.push(new takeFocusInvoker(document)); |
michael@0 | 63 | gQueue.push(new takeFocusInvoker("lb_item3.1")); |
michael@0 | 64 | |
michael@0 | 65 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | function waitForPlugin() |
michael@0 | 69 | { |
michael@0 | 70 | window.setTimeout((isAccessible("plugin") ? doTest : waitForPlugin), 0); |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 74 | setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
michael@0 | 75 | addA11yLoadEvent(waitForPlugin); |
michael@0 | 76 | </script> |
michael@0 | 77 | </head> |
michael@0 | 78 | |
michael@0 | 79 | <body> |
michael@0 | 80 | |
michael@0 | 81 | <a target="_blank" |
michael@0 | 82 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=429547" |
michael@0 | 83 | title="Support aria-activedescendant usage in nsIAccesible::TakeFocus()"> |
michael@0 | 84 | Mozilla Bug 429547 |
michael@0 | 85 | </a> |
michael@0 | 86 | <a target="_blank" |
michael@0 | 87 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=452710" |
michael@0 | 88 | title="nsIAccessible::takeFocus testing"> |
michael@0 | 89 | Mozilla Bug 452710 |
michael@0 | 90 | </a> |
michael@0 | 91 | <a target="_blank" |
michael@0 | 92 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=646361" |
michael@0 | 93 | title="No focus event fired on document when focus is set to the document while focused in a plugin"> |
michael@0 | 94 | Mozilla Bug 646361 |
michael@0 | 95 | </a> |
michael@0 | 96 | <a target="_blank" |
michael@0 | 97 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=706067" |
michael@0 | 98 | title="Make takeFocus work on widget items"> |
michael@0 | 99 | Mozilla Bug 706067 |
michael@0 | 100 | </a> |
michael@0 | 101 | <p id="display"></p> |
michael@0 | 102 | <div id="content" style="display: none"></div> |
michael@0 | 103 | <pre id="test"> |
michael@0 | 104 | </pre> |
michael@0 | 105 | |
michael@0 | 106 | <span id="aria-link" role="link" tabindex="0">link</span> |
michael@0 | 107 | <span id="aria-link2" role="link" tabindex="0">link</span> |
michael@0 | 108 | |
michael@0 | 109 | <a id="link" href="">link</a> |
michael@0 | 110 | |
michael@0 | 111 | <div role="listbox" aria-activedescendant="item1" id="container" tabindex="1"> |
michael@0 | 112 | <div role="option" id="item1">item1</div> |
michael@0 | 113 | <div role="option" id="item2">item2</div> |
michael@0 | 114 | <div role="option" id="item3">item3</div> |
michael@0 | 115 | </div> |
michael@0 | 116 | |
michael@0 | 117 | <embed id="plugin" type="application/x-test" width="200" height="200" wmode="window"></embed> |
michael@0 | 118 | |
michael@0 | 119 | <select id="listbox" size="5"> |
michael@0 | 120 | <option id="lb_item1">item1</option> |
michael@0 | 121 | <option id="lb_item2">item2</option> |
michael@0 | 122 | <optgroup> |
michael@0 | 123 | <option id="lb_item3.1">item 3.1</option> |
michael@0 | 124 | <option id="lb_item3.2">item 3.2</option> |
michael@0 | 125 | </optgroup> |
michael@0 | 126 | </select> |
michael@0 | 127 | </body> |
michael@0 | 128 | </html> |