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.
michael@0 | 1 | <html> |
michael@0 | 2 | |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>ARIA state change event 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 | |
michael@0 | 24 | /** |
michael@0 | 25 | * Do tests. |
michael@0 | 26 | */ |
michael@0 | 27 | var gQueue = null; |
michael@0 | 28 | |
michael@0 | 29 | //gA11yEventDumpID = "eventdump"; // debugging |
michael@0 | 30 | //gA11yEventDumpToConsole = true; // debugging |
michael@0 | 31 | |
michael@0 | 32 | function expandNode(aID, aIsExpanded) |
michael@0 | 33 | { |
michael@0 | 34 | this.DOMNode = getNode(aID); |
michael@0 | 35 | |
michael@0 | 36 | this.eventSeq = [ |
michael@0 | 37 | new expandedStateChecker(aIsExpanded, this.DOMNode) |
michael@0 | 38 | ]; |
michael@0 | 39 | |
michael@0 | 40 | this.invoke = function expandNode_invoke() |
michael@0 | 41 | { |
michael@0 | 42 | this.DOMNode.setAttribute("aria-expanded", |
michael@0 | 43 | (aIsExpanded ? "true" : "false")); |
michael@0 | 44 | }; |
michael@0 | 45 | |
michael@0 | 46 | this.getID = function expandNode_getID() |
michael@0 | 47 | { |
michael@0 | 48 | return prettyName(aID) + " aria-expanded changed to '" + aIsExpanded + "'"; |
michael@0 | 49 | }; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | function busyify(aID, aIsBusy) |
michael@0 | 53 | { |
michael@0 | 54 | this.DOMNode = getNode(aID); |
michael@0 | 55 | |
michael@0 | 56 | this.eventSeq = [ |
michael@0 | 57 | new stateChangeChecker(STATE_BUSY, kOrdinalState, aIsBusy, this.DOMNode) |
michael@0 | 58 | ]; |
michael@0 | 59 | |
michael@0 | 60 | this.invoke = function busyify_invoke() |
michael@0 | 61 | { |
michael@0 | 62 | this.DOMNode.setAttribute("aria-busy", (aIsBusy ? "true" : "false")); |
michael@0 | 63 | }; |
michael@0 | 64 | |
michael@0 | 65 | this.getID = function busyify_getID() |
michael@0 | 66 | { |
michael@0 | 67 | return prettyName(aID) + " aria-busy changed to '" + aIsBusy + "'"; |
michael@0 | 68 | }; |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | function setAttrOfMixedType(aID, aAttr, aState, aValue) |
michael@0 | 72 | { |
michael@0 | 73 | this.DOMNode = getNode(aID); |
michael@0 | 74 | |
michael@0 | 75 | this.eventSeq = [ |
michael@0 | 76 | new stateChangeChecker(aState, kOrdinalState, |
michael@0 | 77 | aValue == "true", this.DOMNode) |
michael@0 | 78 | ]; |
michael@0 | 79 | |
michael@0 | 80 | if (hasState(aID, STATE_MIXED) || aValue == "mixed") { |
michael@0 | 81 | this.eventSeq.push( |
michael@0 | 82 | new stateChangeChecker(STATE_MIXED, kOrdinalState, |
michael@0 | 83 | aValue == "mixed", this.DOMNode) |
michael@0 | 84 | ); |
michael@0 | 85 | } |
michael@0 | 86 | |
michael@0 | 87 | this.invoke = function setAttrOfMixedType_invoke() |
michael@0 | 88 | { |
michael@0 | 89 | this.DOMNode.setAttribute(aAttr, aValue); |
michael@0 | 90 | }; |
michael@0 | 91 | |
michael@0 | 92 | this.getID = function setAttrOfMixedType_getID() |
michael@0 | 93 | { |
michael@0 | 94 | return prettyName(aID) + " " + aAttr + " changed to '" + aValue + "'"; |
michael@0 | 95 | }; |
michael@0 | 96 | } |
michael@0 | 97 | |
michael@0 | 98 | function setPressed(aID, aValue) |
michael@0 | 99 | { |
michael@0 | 100 | this.__proto__ = |
michael@0 | 101 | new setAttrOfMixedType(aID, "aria-pressed", STATE_PRESSED, aValue); |
michael@0 | 102 | } |
michael@0 | 103 | |
michael@0 | 104 | function setChecked(aID, aValue) |
michael@0 | 105 | { |
michael@0 | 106 | this.__proto__ = |
michael@0 | 107 | new setAttrOfMixedType(aID, "aria-checked", STATE_CHECKED, aValue); |
michael@0 | 108 | } |
michael@0 | 109 | |
michael@0 | 110 | function buildQueueForAttrOfMixedType(aQueue, aID, aInvokerFunc) |
michael@0 | 111 | { |
michael@0 | 112 | var list = [ "", "undefined", "false", "true", "mixed" ]; |
michael@0 | 113 | for (var i = 0; i < list.length; i++) { |
michael@0 | 114 | for (var j = i + 1; j < list.length; j++) { |
michael@0 | 115 | // XXX: changes from/to "undefined"/"" shouldn't fire state change |
michael@0 | 116 | // events, bug 472142. |
michael@0 | 117 | aQueue.push(new aInvokerFunc(aID, list[i])); |
michael@0 | 118 | aQueue.push(new aInvokerFunc(aID, list[j])); |
michael@0 | 119 | } |
michael@0 | 120 | } |
michael@0 | 121 | } |
michael@0 | 122 | |
michael@0 | 123 | function doTests() |
michael@0 | 124 | { |
michael@0 | 125 | gQueue = new eventQueue(); |
michael@0 | 126 | |
michael@0 | 127 | gQueue.push(new expandNode("section", true)); |
michael@0 | 128 | gQueue.push(new expandNode("section", false)); |
michael@0 | 129 | gQueue.push(new expandNode("div", true)); |
michael@0 | 130 | gQueue.push(new expandNode("div", false)); |
michael@0 | 131 | |
michael@0 | 132 | gQueue.push(new busyify("aria_doc", true)); |
michael@0 | 133 | gQueue.push(new busyify("aria_doc", false)); |
michael@0 | 134 | |
michael@0 | 135 | buildQueueForAttrOfMixedType(gQueue, "pressable", setPressed); |
michael@0 | 136 | buildQueueForAttrOfMixedType(gQueue, "pressable_native", setPressed); |
michael@0 | 137 | buildQueueForAttrOfMixedType(gQueue, "checkable", setChecked); |
michael@0 | 138 | |
michael@0 | 139 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 140 | } |
michael@0 | 141 | |
michael@0 | 142 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 143 | addA11yLoadEvent(doTests); |
michael@0 | 144 | </script> |
michael@0 | 145 | </head> |
michael@0 | 146 | |
michael@0 | 147 | <body> |
michael@0 | 148 | |
michael@0 | 149 | <a target="_blank" |
michael@0 | 150 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=551684" |
michael@0 | 151 | title="No statechange event for aria-expanded on native HTML elements, is fired on ARIA widgets"> |
michael@0 | 152 | Mozilla Bug 551684 |
michael@0 | 153 | </a><br> |
michael@0 | 154 | <a target="_blank" |
michael@0 | 155 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=648133" |
michael@0 | 156 | title="fire state change event for aria-busy" |
michael@0 | 157 | Mozilla Bug 648133 |
michael@0 | 158 | </a><br> |
michael@0 | 159 | <a target="_blank" |
michael@0 | 160 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=467143" |
michael@0 | 161 | title="mixed state change event is fired for focused accessible only" |
michael@0 | 162 | Mozilla Bug 467143 |
michael@0 | 163 | </a> |
michael@0 | 164 | <a target="_blank" |
michael@0 | 165 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=989958" |
michael@0 | 166 | title="Pressed state is not exposed on a button element with aria-pressed attribute" |
michael@0 | 167 | Mozilla Bug 989958 |
michael@0 | 168 | </a> |
michael@0 | 169 | |
michael@0 | 170 | <p id="display"></p> |
michael@0 | 171 | <div id="content" style="display: none"></div> |
michael@0 | 172 | <pre id="test"> |
michael@0 | 173 | </pre> |
michael@0 | 174 | <div id="eventdump"></div> |
michael@0 | 175 | |
michael@0 | 176 | <!-- aria-expanded --> |
michael@0 | 177 | <div id="section" role="section" aria-expanded="false">expandable section</div> |
michael@0 | 178 | <div id="div" aria-expanded="false">expandable native div</div> |
michael@0 | 179 | |
michael@0 | 180 | <!-- aria-busy --> |
michael@0 | 181 | <div id="aria_doc" role="document" tabindex="0">A document</div> |
michael@0 | 182 | |
michael@0 | 183 | <!-- aria-pressed --> |
michael@0 | 184 | <div id="pressable" role="button"></div> |
michael@0 | 185 | <button id="pressable_native"></button> |
michael@0 | 186 | |
michael@0 | 187 | <!-- aria-checked --> |
michael@0 | 188 | <div id="checkable" role="checkbox"></div> |
michael@0 | 189 | </body> |
michael@0 | 190 | </html> |