Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | <html> |
michael@0 | 2 | |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>HTML selects accessible states tests</title> |
michael@0 | 5 | <link rel="stylesheet" type="text/css" |
michael@0 | 6 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 7 | |
michael@0 | 8 | <script type="application/javascript" |
michael@0 | 9 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="application/javascript" |
michael@0 | 11 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 12 | |
michael@0 | 13 | <script type="application/javascript" |
michael@0 | 14 | src="../common.js"></script> |
michael@0 | 15 | <script type="application/javascript" |
michael@0 | 16 | src="../role.js"></script> |
michael@0 | 17 | <script type="application/javascript" |
michael@0 | 18 | src="../states.js"></script> |
michael@0 | 19 | <script type="application/javascript" |
michael@0 | 20 | src="../events.js"></script> |
michael@0 | 21 | |
michael@0 | 22 | <script type="application/javascript"> |
michael@0 | 23 | function openComboboxNCheckStates(aID) |
michael@0 | 24 | { |
michael@0 | 25 | this.combobox = getAccessible(aID); |
michael@0 | 26 | this.comboboxList = this.combobox.firstChild; |
michael@0 | 27 | this.comboboxOption = this.comboboxList.firstChild; |
michael@0 | 28 | |
michael@0 | 29 | this.eventSeq = [ |
michael@0 | 30 | new invokerChecker(EVENT_FOCUS, this.comboboxOption) |
michael@0 | 31 | ]; |
michael@0 | 32 | |
michael@0 | 33 | this.invoke = function openComboboxNCheckStates_invoke() |
michael@0 | 34 | { |
michael@0 | 35 | getNode(aID).focus(); |
michael@0 | 36 | synthesizeKey("VK_DOWN", { altKey: true }); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | this.finalCheck = function openComboboxNCheckStates_invoke() |
michael@0 | 40 | { |
michael@0 | 41 | // Expanded state on combobox. |
michael@0 | 42 | testStates(this.combobox, STATE_EXPANDED); |
michael@0 | 43 | |
michael@0 | 44 | // Floating state on combobox list. |
michael@0 | 45 | testStates(this.comboboxList, STATE_FLOATING); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | this.getID = function openComboboxNCheckStates_getID() |
michael@0 | 49 | { |
michael@0 | 50 | return "open combobox and test states"; |
michael@0 | 51 | } |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | //gA11yEventDumpToConsole = true; |
michael@0 | 55 | |
michael@0 | 56 | var gQueue = null; |
michael@0 | 57 | function doTest() |
michael@0 | 58 | { |
michael@0 | 59 | // combobox |
michael@0 | 60 | var combobox = getAccessible("combobox"); |
michael@0 | 61 | testStates(combobox, |
michael@0 | 62 | STATE_HASPOPUP | STATE_COLLAPSED | STATE_FOCUSABLE, 0, |
michael@0 | 63 | STATE_FOCUSED, 0); |
michael@0 | 64 | |
michael@0 | 65 | var comboboxList = combobox.firstChild; |
michael@0 | 66 | testStates(comboboxList, STATE_INVISIBLE, 0, STATE_FOCUSABLE, 0); |
michael@0 | 67 | |
michael@0 | 68 | var opt1 = comboboxList.firstChild; |
michael@0 | 69 | testStates(opt1, STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE, |
michael@0 | 70 | EXT_STATE_ACTIVE, STATE_FOCUSED, 0); |
michael@0 | 71 | |
michael@0 | 72 | var opt2 = comboboxList.lastChild; |
michael@0 | 73 | testStates(opt2, STATE_SELECTABLE | STATE_FOCUSABLE, 0, STATE_SELECTED, 0, |
michael@0 | 74 | STATE_FOCUSED, EXT_STATE_ACTIVE); |
michael@0 | 75 | |
michael@0 | 76 | // collapsed combobox |
michael@0 | 77 | testStates("collapsedcombobox", |
michael@0 | 78 | STATE_COLLAPSED | STATE_FOCUSABLE, 0, |
michael@0 | 79 | STATE_FOCUSED, 0); |
michael@0 | 80 | |
michael@0 | 81 | testStates("collapsed-1", |
michael@0 | 82 | STATE_FOCUSABLE | STATE_SELECTABLE, 0, |
michael@0 | 83 | STATE_OFFSCREEN | STATE_INVISIBLE, 0); |
michael@0 | 84 | |
michael@0 | 85 | testStates("collapsed-2", |
michael@0 | 86 | STATE_OFFSCREEN, 0, |
michael@0 | 87 | STATE_INVISIBLE, 0); |
michael@0 | 88 | |
michael@0 | 89 | // listbox |
michael@0 | 90 | testStates("listbox", |
michael@0 | 91 | STATE_FOCUSABLE, 0, |
michael@0 | 92 | STATE_HASPOPUP | STATE_COLLAPSED | STATE_FOCUSED); |
michael@0 | 93 | |
michael@0 | 94 | testStates("listitem-active", |
michael@0 | 95 | STATE_FOCUSABLE | STATE_SELECTABLE, EXT_STATE_ACTIVE, |
michael@0 | 96 | STATE_SELECTED | STATE_FOCUSED); |
michael@0 | 97 | |
michael@0 | 98 | testStates("listitem", |
michael@0 | 99 | STATE_FOCUSABLE | STATE_SELECTABLE, 0, |
michael@0 | 100 | STATE_SELECTED | STATE_FOCUSED, EXT_STATE_ACTIVE); |
michael@0 | 101 | |
michael@0 | 102 | testStates("listitem-disabled", |
michael@0 | 103 | STATE_UNAVAILABLE, 0, |
michael@0 | 104 | STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE, |
michael@0 | 105 | EXT_STATE_ACTIVE); |
michael@0 | 106 | |
michael@0 | 107 | testStates("listgroup", |
michael@0 | 108 | 0, 0, |
michael@0 | 109 | STATE_UNAVAILABLE | STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE, |
michael@0 | 110 | EXT_STATE_ACTIVE); |
michael@0 | 111 | |
michael@0 | 112 | testStates("listgroup-disabled", |
michael@0 | 113 | STATE_UNAVAILABLE, 0, |
michael@0 | 114 | STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE, |
michael@0 | 115 | EXT_STATE_ACTIVE); |
michael@0 | 116 | |
michael@0 | 117 | todo(false, "no unavailable state on option in disabled group (bug 759666)"); |
michael@0 | 118 | // testStates("listitem-disabledgroup", |
michael@0 | 119 | // STATE_UNAVAILABLE, 0, |
michael@0 | 120 | // STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE, |
michael@0 | 121 | // EXT_STATE_ACTIVE); |
michael@0 | 122 | |
michael@0 | 123 | testStates("listbox-disabled", |
michael@0 | 124 | STATE_UNAVAILABLE, 0, |
michael@0 | 125 | STATE_FOCUSABLE); |
michael@0 | 126 | |
michael@0 | 127 | todo(false, "no unavailable state on option in disabled select (bug 759666)"); |
michael@0 | 128 | // testStates("listitem-disabledlistbox", |
michael@0 | 129 | // STATE_UNAVAILABLE, 0, |
michael@0 | 130 | // STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE, |
michael@0 | 131 | // EXT_STATE_ACTIVE); |
michael@0 | 132 | |
michael@0 | 133 | // open combobox |
michael@0 | 134 | gQueue = new eventQueue(); |
michael@0 | 135 | gQueue.push(new openComboboxNCheckStates("combobox")); |
michael@0 | 136 | gQueue.invoke(); // Will call */SimpleTest.finish(); |
michael@0 | 137 | } |
michael@0 | 138 | |
michael@0 | 139 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 140 | addA11yLoadEvent(doTest); |
michael@0 | 141 | </script> |
michael@0 | 142 | |
michael@0 | 143 | </head> |
michael@0 | 144 | |
michael@0 | 145 | <body> |
michael@0 | 146 | <a target="_blank" |
michael@0 | 147 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=443889" |
michael@0 | 148 | title="mochitest for selects and lists"> |
michael@0 | 149 | Mozilla Bug 443889 |
michael@0 | 150 | </a> |
michael@0 | 151 | <a target="_blank" |
michael@0 | 152 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=640716" |
michael@0 | 153 | title="mochitest for selects and lists"> |
michael@0 | 154 | Mozilla Bug 640716 |
michael@0 | 155 | </a> |
michael@0 | 156 | <a target="_blank" |
michael@0 | 157 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=689847" |
michael@0 | 158 | title="Expose active state on current item of selectable widgets"> |
michael@0 | 159 | Mozilla Bug 689847 |
michael@0 | 160 | </a> |
michael@0 | 161 | <a target="_blank" |
michael@0 | 162 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=756983" |
michael@0 | 163 | title="Isolate focusable and unavailable states from State()"> |
michael@0 | 164 | Mozilla Bug 756983 |
michael@0 | 165 | </a> |
michael@0 | 166 | <a target="_blank" |
michael@0 | 167 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=907682" |
michael@0 | 168 | title=" HTML:option group position is not correct when select is collapsed"> |
michael@0 | 169 | Mozilla Bug 907682 |
michael@0 | 170 | </a> |
michael@0 | 171 | <p id="display"></p> |
michael@0 | 172 | <div id="content" style="display: none"></div> |
michael@0 | 173 | <pre id="test"> |
michael@0 | 174 | </pre> |
michael@0 | 175 | |
michael@0 | 176 | <select id="combobox"> |
michael@0 | 177 | <option>item 1</option> |
michael@0 | 178 | <option>item 2</option> |
michael@0 | 179 | </select> |
michael@0 | 180 | |
michael@0 | 181 | <select id="collapsedcombobox"> |
michael@0 | 182 | <option id="collapsed-1">item 1</option> |
michael@0 | 183 | <option id="collapsed-2">item 2</option> |
michael@0 | 184 | </select> |
michael@0 | 185 | |
michael@0 | 186 | <select id="listbox" name="component" size="3"> |
michael@0 | 187 | <option id="listitem-active">Build</option> |
michael@0 | 188 | <option id="listitem">Disability Access APIs</option> |
michael@0 | 189 | <option id="listitem-disabled" disabled>General</option> |
michael@0 | 190 | <optgroup id="listgroup" label="group"> |
michael@0 | 191 | <option>option</option> |
michael@0 | 192 | </optgroup> |
michael@0 | 193 | <optgroup id="listgroup-disabled" disabled label="group2"> |
michael@0 | 194 | <option id="listitem-disabledgroup">UI</option> |
michael@0 | 195 | </optgroup> |
michael@0 | 196 | </select> |
michael@0 | 197 | |
michael@0 | 198 | <select id="listbox-disabled" size="3" disabled> |
michael@0 | 199 | <option id="listitem-disabledlistbox">option</option> |
michael@0 | 200 | </select> |
michael@0 | 201 | |
michael@0 | 202 | </body> |
michael@0 | 203 | </html> |