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.
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"
4 type="text/css"?>
6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
7 title="Accessibility Loading Document Events Test.">
9 <script type="application/javascript"
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
11 <script type="application/javascript"
12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
14 <script type="application/javascript"
15 src="../common.js"></script>
16 <script type="application/javascript"
17 src="../role.js"></script>
18 <script type="application/javascript"
19 src="../states.js"></script>
20 <script type="application/javascript"
21 src="../events.js"></script>
22 <script type="application/javascript"
23 src="../browser.js"></script>
25 <script type="application/javascript">
26 <![CDATA[
27 ////////////////////////////////////////////////////////////////////////////
28 // Invoker checkers.
29 function stateBusyChecker(aIsEnabled)
30 {
31 this.type = EVENT_STATE_CHANGE;
32 this.__defineGetter__("target", currentTabDocument);
34 this.check = function stateBusyChecker_check(aEvent)
35 {
36 var event = null;
37 try {
38 var event = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
39 } catch (e) {
40 ok(false, "State change event was expected");
41 }
43 if (!event)
44 return;
46 is(event.state, STATE_BUSY, "Wrong state of statechange event.");
47 is(event.isEnabled, aIsEnabled,
48 "Wrong value of state of statechange event");
50 testStates(event.accessible, (aIsEnabled ? STATE_BUSY : 0), 0,
51 (aIsEnabled ? 0 : STATE_BUSY), 0);
52 }
53 }
55 function documentReloadChecker(aIsFromUserInput)
56 {
57 this.type = EVENT_DOCUMENT_RELOAD;
58 this.__defineGetter__("target", currentTabDocument);
60 this.check = function documentReloadChecker_check(aEvent)
61 {
62 is(aEvent.isFromUserInput, aIsFromUserInput,
63 "Wrong value of isFromUserInput");
64 }
65 }
67 ////////////////////////////////////////////////////////////////////////////
68 // Invokers.
70 /**
71 * Load URI.
72 */
73 function loadURIInvoker(aURI)
74 {
75 this.invoke = function loadURIInvoker_invoke()
76 {
77 tabBrowser().loadURI(aURI);
78 }
80 this.eventSeq = [
81 // We don't expect state change event for busy true since things happen
82 // quickly and it's coalesced.
83 new asyncInvokerChecker(EVENT_REORDER, currentBrowser),
84 new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
85 new stateBusyChecker(false)
86 ];
88 this.getID = function loadURIInvoker_getID()
89 {
90 return "load uri " + aURI;
91 }
92 }
94 /**
95 * Load the document having sub document. No document loading events for
96 * nested document.
97 */
98 function loadNestedDocURIInvoker(aNestedDocURI)
99 {
100 this.__proto__ = new loadURIInvoker(aNestedDocURI);
102 // Remove reorder event checker since the event is likely coalesced by
103 // reorder event on Firefox UI (refer to bug 759670 for details).
104 this.eventSeq.shift();
106 this.unexpectedEventSeq = [
107 new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, getNestedDoc),
108 new invokerChecker(EVENT_STATE_CHANGE, getNestedDoc)
109 ];
111 function getNestedDoc()
112 {
113 var iframeNodes = currentTabDocument().getElementsByTagName("iframe");
114 return iframeNodes && iframeNodes.length > 0 ?
115 iframeNodes[0].firstChild : null;
116 }
117 }
119 /**
120 * Reload the page by F5 (isFromUserInput flag is true).
121 */
122 function userReloadInvoker()
123 {
124 this.invoke = function userReloadInvoker_invoke()
125 {
126 synthesizeKey("VK_F5", {}, browserWindow());
127 }
129 this.eventSeq = [
130 new documentReloadChecker(true),
131 new asyncInvokerChecker(EVENT_REORDER, currentBrowser),
132 new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
133 new stateBusyChecker(false)
134 ];
136 this.getID = function userReloadInvoker_getID()
137 {
138 return "user reload page";
139 }
140 }
142 /**
143 * Reload the page (isFromUserInput flag is false).
144 */
145 function reloadInvoker()
146 {
147 this.invoke = function reloadInvoker_invoke()
148 {
149 tabBrowser().reload();
150 }
152 this.eventSeq = [
153 new documentReloadChecker(false),
154 new asyncInvokerChecker(EVENT_REORDER, currentBrowser),
155 new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
156 new stateBusyChecker(false)
157 ];
159 this.getID = function reloadInvoker_getID()
160 {
161 return "reload page";
162 }
163 }
165 /**
166 * Load wrong URI what results in error page loading.
167 */
168 function loadErrorPageInvoker(aURL, aURLDescr)
169 {
170 this.invoke = function loadErrorPageInvoker_invoke()
171 {
172 tabBrowser().loadURI(aURL);
173 }
175 this.eventSeq = [
176 // We don't expect state change for busy true, load stopped events since
177 // things happen quickly and it's coalesced.
178 new asyncInvokerChecker(EVENT_REORDER, currentBrowser),
179 new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
180 new stateBusyChecker(false)
181 ];
183 this.getID = function loadErrorPageInvoker_getID()
184 {
185 return "load error page: '" + aURLDescr + "'";
186 }
187 }
189 ////////////////////////////////////////////////////////////////////////////
190 // Tests
192 //gA11yEventDumpToConsole = true; // debug
193 //gA11yEventDumpFeature = "parentchain:reorder";
195 var gQueue = null;
196 function doTests()
197 {
198 gQueue = new eventQueue();
200 var dataURL =
201 "data:text/html,<html><body><iframe src='http://example.com'></iframe></body></html>";
202 gQueue.push(new loadNestedDocURIInvoker(dataURL));
204 gQueue.push(new loadURIInvoker("about:"));
205 gQueue.push(new userReloadInvoker());
206 gQueue.push(new loadURIInvoker("about:mozilla"));
207 gQueue.push(new reloadInvoker());
208 gQueue.push(new loadErrorPageInvoker("www.wronguri.wronguri",
209 "Server not found"));
210 gQueue.push(new loadErrorPageInvoker("https://nocert.example.com:443",
211 "Untrusted Connection"));
213 gQueue.onFinish = function() { closeBrowserWindow(); }
214 gQueue.invoke();
215 }
217 SimpleTest.waitForExplicitFinish();
218 openBrowserWindow(doTests);
219 ]]>
220 </script>
222 <vbox flex="1" style="overflow: auto;">
223 <body xmlns="http://www.w3.org/1999/xhtml">
224 <a target="_blank"
225 href="https://bugzilla.mozilla.org/show_bug.cgi?id=566103"
226 title=" reorganize accessible document handling">
227 Mozilla Bug 566103
228 </a>
229 <a target="_blank"
230 href="https://bugzilla.mozilla.org/show_bug.cgi?id=754165"
231 title="Fire document load events on iframes too">
232 Mozilla Bug 754165
233 </a>
234 <p id="display"></p>
235 <div id="content" style="display: none">
236 </div>
237 <pre id="test">
238 </pre>
239 </body>
241 <vbox id="eventdump"></vbox>
242 </vbox>
243 </window>