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"
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();
20 // Makes sure that we fire the visibilitychange events
21 function* testIterator() {
25 // Load something for a start
27 uri: 'data:text/html,
<title>initial load
</title>',
28 onNavComplete: nextTest
32 // Now load a new page
34 uri: 'data:text/html,
<title>new load
</title>',
35 eventsToListenFor: [
"pageshow",
"pagehide",
"visibilitychange" ],
36 expectedEvents: [ { type:
"pagehide",
37 title:
"initial load",
39 { type:
"visibilitychange",
40 title:
"initial load",
41 visibilityState:
"hidden",
43 // No visibilitychange events fired for initial pageload
46 persisted: false }, // false on initial load
48 onNavComplete: nextTest
55 eventsToListenFor: [
"pageshow",
"pagehide",
"visibilitychange" ],
56 expectedEvents: [ { type:
"pagehide",
59 { type:
"visibilitychange",
61 visibilityState:
"hidden",
63 { type:
"visibilitychange",
64 title:
"initial load",
65 visibilityState:
"visible",
68 title:
"initial load",
71 onNavComplete: nextTest
78 eventsToListenFor: [
"pageshow",
"pagehide",
"visibilitychange" ],
79 expectedEvents: [ { type:
"pagehide",
80 title:
"initial load",
82 { type:
"visibilitychange",
83 title:
"initial load",
84 visibilityState:
"hidden",
86 { type:
"visibilitychange",
88 visibilityState:
"visible",
94 onNavComplete: nextTest
99 eventsToListenFor: [
"visibilitychange" ],
100 expectedEvents: [ { type:
"visibilitychange",
102 visibilityState:
"hidden",
105 onNavComplete: nextTest
108 // Now flip our docshell to not active
109 TestWindow.getBrowser().docShellIsActive = false;
112 // And navigate back; there should be no visibility state transitions
115 eventsToListenFor: [
"pageshow",
"pagehide",
"visibilitychange" ],
116 expectedEvents: [ { type:
"pagehide",
120 title:
"initial load",
123 unexpectedEvents: [
"visibilitychange" ],
124 onNavComplete: nextTest
129 eventsToListenFor: [
"visibilitychange" ],
130 expectedEvents: [ { type:
"visibilitychange",
131 title:
"initial load",
132 visibilityState:
"visible",
135 onNavComplete: nextTest
138 // Now set the docshell active again
139 TestWindow.getBrowser().docShellIsActive = true;
145 eventsToListenFor: [
"pageshow",
"pagehide",
"visibilitychange" ],
146 expectedEvents: [ { type:
"pagehide",
147 title:
"initial load",
149 { type:
"visibilitychange",
150 title:
"initial load",
151 visibilityState:
"hidden",
153 { type:
"visibilitychange",
155 visibilityState:
"visible",
161 onNavComplete: nextTest
165 // Tell the framework the test is finished.
170 <browser type=
"content" primary=
"true" flex=
"1" id=
"content" remote=
"true" maychangeremoteness=
"true" />