|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 |
|
4 <window id="514732Test" |
|
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 514732 test"> |
|
10 |
|
11 <script type="text/javascript" |
|
12 src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/> |
|
13 <script type="text/javascript" |
|
14 src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/> |
|
15 <script type="text/javascript" |
|
16 src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/> |
|
17 <script type="application/javascript" |
|
18 src="chrome://mochikit/content/tests/SimpleTest/docshell_helpers.js"> |
|
19 </script> |
|
20 |
|
21 <script type="application/javascript"><![CDATA[ |
|
22 |
|
23 // Define the generator-iterator for the tests. |
|
24 var tests = testIterator(); |
|
25 |
|
26 //// |
|
27 // Execute the next test in the generator function. |
|
28 // |
|
29 function nextTest() { |
|
30 tests.next(); |
|
31 } |
|
32 |
|
33 //// |
|
34 // Generator function for test steps for bug 514732. The MozScrolledAreaChanged |
|
35 // should be fired when a page is restored from the bfcache as though it had |
|
36 // reloaded. |
|
37 // |
|
38 function testIterator() { |
|
39 // Make sure bfcache is on. |
|
40 enableBFCache(true); |
|
41 |
|
42 |
|
43 // Load a wide and tall page, and then another. |
|
44 for (var i = 0; i < 2; ++i) { |
|
45 doPageNavigation( { |
|
46 uri: "data:text/html,<!DOCTYPE html><html>" + |
|
47 "<head><title>bug 514732 bfcache test page " + i + "</title></head>" + |
|
48 "<body>" + |
|
49 '<div style="position: absolute; left: 10000px; top: 10000px; width: 500px; height: 500px;">' + |
|
50 "</body></html>", |
|
51 eventsToListenFor: ["MozScrolledAreaChanged"], |
|
52 expectedEvents: [ { type: "MozScrolledAreaChanged" } ], |
|
53 onNavComplete: nextTest |
|
54 } ); |
|
55 yield; |
|
56 } |
|
57 |
|
58 // Navigate back to the first page. Don't test for width and height |
|
59 // yet, just make sure we get an event. |
|
60 doPageNavigation( { |
|
61 back: true, |
|
62 eventsToListenFor: ["MozScrolledAreaChanged"], |
|
63 expectedEvents: [ { type: "MozScrolledAreaChanged" } ], |
|
64 onNavComplete: nextTest |
|
65 } ); |
|
66 yield; |
|
67 |
|
68 // Navigate forth to our wide and tall page, this time testing for |
|
69 // width and height on the event. |
|
70 doPageNavigation( { |
|
71 forward: true, |
|
72 eventsToListenFor: ["MozScrolledAreaChanged"], |
|
73 expectedEvents: [ { type: "MozScrolledAreaChanged" } ], |
|
74 onNavComplete: nextTest |
|
75 } ); |
|
76 yield; |
|
77 |
|
78 // Tell the framework the test is finished. Include the final 'yield' |
|
79 // statement to prevent a StopIteration exception from being thrown. |
|
80 finish(); |
|
81 yield; |
|
82 } |
|
83 |
|
84 ]]></script> |
|
85 |
|
86 <browser type="content-primary" flex="1" id="content" src="about:blank"/> |
|
87 </window> |