Bug 1839316: part 5) Guard the "fetchpriority" attribute behind a pref. r=kershaw...
[gecko.git] / docshell / test / chrome / bug690056_window.xhtml
blobfb5dfaea40653cbb38c90217d2519594aa1a0058
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
4 <window id="690056Test"
5 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
6 width="600"
7 height="600"
8 onload="setTimeout(nextTest, 0);"
9 title="bug 6500056 test">
11 <script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
12 <script type="application/javascript" src="docshell_helpers.js" />
13 <script type="application/javascript"><![CDATA[
14 var tests = testIterator();
16 function nextTest() {
17 tests.next();
20 // Makes sure that we fire the visibilitychange events
21 function* testIterator() {
22 // Enable bfcache
23 enableBFCache(8);
25 // Load something for a start
26 doPageNavigation({
27 uri: 'data:text/html,<title>initial load</title>',
28 onNavComplete: nextTest
29 });
30 yield undefined;
32 // Now load a new page
33 doPageNavigation({
34 uri: 'data:text/html,<title>new load</title>',
35 eventsToListenFor: [ "pageshow", "pagehide", "visibilitychange" ],
36 expectedEvents: [ { type: "pagehide",
37 title: "initial load",
38 persisted: true },
39 { type: "visibilitychange",
40 title: "initial load",
41 visibilityState: "hidden",
42 hidden: true },
43 // No visibilitychange events fired for initial pageload
44 { type: "pageshow",
45 title: "new load",
46 persisted: false }, // false on initial load
48 onNavComplete: nextTest
49 });
50 yield undefined;
52 // Now go back
53 doPageNavigation({
54 back: true,
55 eventsToListenFor: [ "pageshow", "pagehide", "visibilitychange" ],
56 expectedEvents: [ { type: "pagehide",
57 title: "new load",
58 persisted: true },
59 { type: "visibilitychange",
60 title: "new load",
61 visibilityState: "hidden",
62 hidden: true },
63 { type: "visibilitychange",
64 title: "initial load",
65 visibilityState: "visible",
66 hidden: false },
67 { type: "pageshow",
68 title: "initial load",
69 persisted: true },
71 onNavComplete: nextTest
72 });
73 yield undefined;
75 // And forward
76 doPageNavigation({
77 forward: true,
78 eventsToListenFor: [ "pageshow", "pagehide", "visibilitychange" ],
79 expectedEvents: [ { type: "pagehide",
80 title: "initial load",
81 persisted: true },
82 { type: "visibilitychange",
83 title: "initial load",
84 visibilityState: "hidden",
85 hidden: true },
86 { type: "visibilitychange",
87 title: "new load",
88 visibilityState: "visible",
89 hidden: false },
90 { type: "pageshow",
91 title: "new load",
92 persisted: true },
94 onNavComplete: nextTest
95 });
96 yield undefined;
98 waitForPageEvents({
99 eventsToListenFor: [ "visibilitychange" ],
100 expectedEvents: [ { type: "visibilitychange",
101 title: "new load",
102 visibilityState: "hidden",
103 hidden: true },
105 onNavComplete: nextTest
108 // Now flip our docshell to not active
109 TestWindow.getBrowser().docShellIsActive = false;
110 yield undefined;
112 // And navigate back; there should be no visibility state transitions
113 doPageNavigation({
114 back: true,
115 eventsToListenFor: [ "pageshow", "pagehide", "visibilitychange" ],
116 expectedEvents: [ { type: "pagehide",
117 title: "new load",
118 persisted: true },
119 { type: "pageshow",
120 title: "initial load",
121 persisted: true },
123 unexpectedEvents: [ "visibilitychange" ],
124 onNavComplete: nextTest
126 yield undefined;
128 waitForPageEvents({
129 eventsToListenFor: [ "visibilitychange" ],
130 expectedEvents: [ { type: "visibilitychange",
131 title: "initial load",
132 visibilityState: "visible",
133 hidden: false },
135 onNavComplete: nextTest
138 // Now set the docshell active again
139 TestWindow.getBrowser().docShellIsActive = true;
140 yield undefined;
142 // And forward
143 doPageNavigation({
144 forward: true,
145 eventsToListenFor: [ "pageshow", "pagehide", "visibilitychange" ],
146 expectedEvents: [ { type: "pagehide",
147 title: "initial load",
148 persisted: true },
149 { type: "visibilitychange",
150 title: "initial load",
151 visibilityState: "hidden",
152 hidden: true },
153 { type: "visibilitychange",
154 title: "new load",
155 visibilityState: "visible",
156 hidden: false },
157 { type: "pageshow",
158 title: "new load",
159 persisted: true },
161 onNavComplete: nextTest
163 yield undefined;
165 // Tell the framework the test is finished.
166 finish();
168 ]]></script>
170 <browser type="content" primary="true" flex="1" id="content" remote="true" maychangeremoteness="true" />
171 </window>