image/test/mochitest/test_bug89419-2.html

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:d047c543ffd1
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=89419
5 -->
6 <head>
7 <title>Test for Bug 89419</title>
8 <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=89419">Mozilla Bug 89419</a>
15 <p id="display"></p>
16 <pre id="test">
17 <script type="application/javascript">
18
19 var first, second, third;
20 var correct, val1, val2;
21
22 SimpleTest.waitForExplicitFinish();
23
24 function checkFirst()
25 {
26 var iframeelem = document.getElementById('test-iframe');
27 first = snapshotWindow(iframeelem.contentWindow, false);
28
29 iframeelem.onload = checkSecond;
30 iframeelem.contentWindow.location.href = iframeelem.contentWindow.location.href;
31 }
32
33 function checkSecond()
34 {
35 var iframeelem = document.getElementById('test-iframe');
36 second = snapshotWindow(iframeelem.contentWindow, false);
37
38 // Check that we actually reloaded.
39 [correct, val1, val2] = compareSnapshots(first, second, false);
40 ok(correct, "Image should have changed after the first reload.");
41
42 iframeelem.onload = checkThird;
43 iframeelem.contentWindow.location.href = iframeelem.contentWindow.location.href;
44 }
45
46 function checkThird()
47 {
48 var iframeelem = document.getElementById('test-iframe');
49 third = snapshotWindow(iframeelem.contentWindow, false);
50
51 // Check that we actually reloaded.
52 [correct, val1, val2] = compareSnapshots(second, third, false);
53 ok(correct, "Image should have changed after the second reload.");
54
55 // Make sure we looped back to the first image.
56 [correct, val1, val2] = compareSnapshots(first, third, true);
57 ok(correct, "Third image should match first image.");
58
59 SimpleTest.finish();
60 }
61
62 </script>
63 </pre>
64 <div id="content"> <!-- style="display: none" -->
65 <iframe id="test-iframe" src="bug89419-iframe.html" onload="checkFirst()"></iframe>
66 </div>
67 </body>
68 </html>

mercurial