layout/base/tests/test_bug607529.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:d838d9f5c483
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=607529
5 -->
6 <head>
7 <title>Test for Bug 607529</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=607529">Mozilla Bug 607529</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
15
16 </div>
17 <pre id="test">
18 <script type="application/javascript">
19 SimpleTest.waitForExplicitFinish();
20
21 /* General idea: Open a new window (needed because we don't bfcache
22 subframes) that uses mozRequestAnimationFrame, navigate it, navigate it
23 back, and verify that the animations are still running. */
24
25 var doneOneLoad = false;
26
27 /** Test for Bug 607529 **/
28 var done = false;
29 window.onmessage = function(e) {
30 isnot(e.data, "notcached", "Should never end up not being cached");
31
32 if (e.data == "loaded" && !doneOneLoad) {
33 doneOneLoad = true;
34 w.location = "data:text/html,<script>window.onload = function() { opener.postMessage('goback', '*'); }</" + "script>";
35 }
36 else if (e.data == "goback") {
37 w.history.back();
38 }
39 else if (e.data == "revived") {
40 w.postMessage("report", "*");
41 }
42 else if (e.data == "callbackHappened") {
43 // We might get this message more than once, if the other page queues up
44 // more than one callbackHappened message before we manage to close it.
45 // Protect against calling SimpleTest.finish() more than once.
46 if (!done) {
47 w.close();
48 SimpleTest.finish();
49 done = true;
50 }
51 } else {
52 var msg = JSON.parse(e.data);
53 if (msg.error) {
54 window.onerror(msg.msg, msg.url, msg.line);
55 }
56 }
57 };
58
59 var w = window.open("file_bug607529.html");
60 </script>
61 </pre>
62 </body>
63 </html>

mercurial