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.
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
4 <!--
5 XUL Widget Test for tabindex
6 -->
7 <window title="tabindex" width="500" height="600"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
12 <!--
13 Elements are navigated in the following order:
14 1. tabindex > 0 in tree order
15 2. tabindex = 0 in tree order
16 Elements with tabindex = -1 are not in the tab order
17 -->
18 <hbox>
19 <button id="t5" label="One"/>
20 <checkbox id="no1" label="Two" tabindex="-1"/>
21 <button id="t6" label="Three" tabindex="0"/>
22 <checkbox id="t1" label="Four" tabindex="1"/>
23 </hbox>
24 <hbox>
25 <textbox id="t7" idmod="t3" size="3"/>
26 <textbox id="no2" size="3" tabindex="-1"/>
27 <textbox id="t8" idmod="t4" size="3" tabindex="0"/>
28 <textbox id="t2" idmod="t1" size="3" tabindex="1"/>
29 </hbox>
30 <hbox>
31 <button id="no3" style="-moz-user-focus: ignore;" label="One"/>
32 <checkbox id="no4" style="-moz-user-focus: ignore;" label="Two" tabindex="-1"/>
33 <button id="t9" style="-moz-user-focus: ignore;" label="Three" tabindex="0"/>
34 <checkbox id="t3" style="-moz-user-focus: ignore;" label="Four" tabindex="1"/>
35 </hbox>
36 <hbox>
37 <textbox id="t10" idmod="t5" style="-moz-user-focus: ignore;" size="3"/>
38 <textbox id="no5" style="-moz-user-focus: ignore;" size="3" tabindex="-1"/>
39 <textbox id="t11" idmod="t6" style="-moz-user-focus: ignore;" size="3" tabindex="0"/>
40 <textbox id="t4" idmod="t2" style="-moz-user-focus: ignore;" size="3" tabindex="1"/>
41 </hbox>
42 <listbox id="t12" idmod="t7">
43 <listitem label="Item One"/>
44 </listbox>
46 <hbox>
47 <!-- the tabindex attribute does not apply to non-controls, so it
48 should be treated as -1 for non-focusable dropmarkers, and 0
49 for focusable dropmarkers. Thus, the first four dropmarkers
50 are not in the tab order, and the last four dropmarkers should
51 be in the tab order just after the listbox above.
52 -->
53 <dropmarker id="no6"/>
54 <dropmarker id="no7" tabindex="-1"/>
55 <dropmarker id="no8" tabindex="0"/>
56 <dropmarker id="no9" tabindex="1"/>
57 <dropmarker id="t13" style="-moz-user-focus: normal;"/>
58 <dropmarker id="t14" style="-moz-user-focus: normal;" tabindex="-1"/>
59 <dropmarker id="t15" style="-moz-user-focus: normal;" tabindex="0"/>
60 <dropmarker id="t16" style="-moz-user-focus: normal;" tabindex="1"/>
61 </hbox>
63 <body xmlns="http://www.w3.org/1999/xhtml">
64 <p id="display"></p>
65 <div id="content" style="display: none">
66 </div>
67 <pre id="test">
68 </pre>
69 </body>
71 <script>
72 <![CDATA[
74 SimpleTest.waitForExplicitFinish();
76 var gAdjustedTabFocusModel = false;
77 var gTestCount = 16;
78 var gTestsOccurred = 0;
80 function runTests()
81 {
82 var t;
83 window.addEventListener("focus", function (event) {
84 if (t == 1 && event.target.id == "t2") {
85 // looks to be using the MacOSX Full Keyboard Access set to Textboxes
86 // and lists only so use the idmod attribute instead
87 gAdjustedTabFocusModel = true;
88 gTestCount = 7;
89 }
91 var attrcompare = gAdjustedTabFocusModel ? "idmod" : "id";
93 // check for the last test which should wrap aorund to the first item
94 // consider the focus event on the inner input of textboxes instead
95 if (event.originalTarget.localName == "input") {
96 is(document.getBindingParent(event.originalTarget).getAttribute(attrcompare),
97 "t" + t, "tab " + t + " to inner input");
98 gTestsOccurred++;
99 }
100 else {
101 is(event.target.getAttribute(attrcompare), "t" + t, "tab " + t + " to " + event.target.localName)
102 if (event.target.localName != "textbox")
103 gTestsOccurred++;
104 }
105 }, true);
107 for (t = 1; t <= gTestCount; t++)
108 synthesizeKey("VK_TAB", { });
110 is(gTestsOccurred, gTestCount, "test count");
111 SimpleTest.finish();
112 }
114 SimpleTest.waitForFocus(runTests);
116 ]]>
118 </script>
120 </window>