layout/base/tests/test_bug607529.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/test_bug607529.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=607529
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 607529</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=607529">Mozilla Bug 607529</a>
    1.16 +<p id="display"></p>
    1.17 +<div id="content" style="display: none">
    1.18 +  
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script type="application/javascript">
    1.22 +  SimpleTest.waitForExplicitFinish();
    1.23 +
    1.24 +  /* General idea: Open a new window (needed because we don't bfcache
    1.25 +     subframes) that uses mozRequestAnimationFrame, navigate it, navigate it
    1.26 +     back, and verify that the animations are still running.  */
    1.27 +
    1.28 +  var doneOneLoad = false;
    1.29 +
    1.30 +  /** Test for Bug 607529 **/
    1.31 +  var done = false;
    1.32 +  window.onmessage = function(e) {
    1.33 +    isnot(e.data, "notcached", "Should never end up not being cached");
    1.34 +  
    1.35 +    if (e.data == "loaded" && !doneOneLoad) {
    1.36 +      doneOneLoad = true;
    1.37 +      w.location = "data:text/html,<script>window.onload = function() { opener.postMessage('goback', '*'); }</" + "script>";
    1.38 +    }
    1.39 +    else if (e.data == "goback") {
    1.40 +      w.history.back();
    1.41 +    }
    1.42 +    else if (e.data == "revived") {
    1.43 +      w.postMessage("report", "*");
    1.44 +    }
    1.45 +    else if (e.data == "callbackHappened") {
    1.46 +      // We might get this message more than once, if the other page queues up
    1.47 +      // more than one callbackHappened message before we manage to close it.
    1.48 +      // Protect against calling SimpleTest.finish() more than once.
    1.49 +      if (!done) {
    1.50 +	w.close();
    1.51 +	SimpleTest.finish();
    1.52 +	done = true;
    1.53 +      }
    1.54 +    } else {
    1.55 +      var msg = JSON.parse(e.data);
    1.56 +      if (msg.error) {
    1.57 +        window.onerror(msg.msg, msg.url, msg.line);
    1.58 +      }
    1.59 +    }
    1.60 +  };
    1.61 +
    1.62 +  var w = window.open("file_bug607529.html");
    1.63 +</script>
    1.64 +</pre>
    1.65 +</body>
    1.66 +</html>

mercurial