image/test/mochitest/test_bug671906.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/image/test/mochitest/test_bug671906.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=671906
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 671906</title>
    1.11 +  <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
    1.14 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.15 +</head>
    1.16 +<body>
    1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=671906">Mozilla Bug 671906</a>
    1.18 +<p id="display"></p>
    1.19 +<pre id="test">
    1.20 +<script type="application/javascript">
    1.21 +
    1.22 +var first, second, third;
    1.23 +var correct, val1, val2;
    1.24 +
    1.25 +SimpleTest.waitForExplicitFinish();
    1.26 +
    1.27 +function snapshotFirst()
    1.28 +{
    1.29 +  var iframeelem = document.getElementById('test-iframe');
    1.30 +  first = snapshotWindow(iframeelem.contentWindow, false);
    1.31 +
    1.32 +  iframeelem.onload = snapshotSecond;
    1.33 +  iframeelem.src = "http://example.com/tests/image/test/mochitest/bug671906-iframe.html";
    1.34 +}
    1.35 +
    1.36 +function snapshotSecond()
    1.37 +{
    1.38 +  var iframeelem = document.getElementById('test-iframe');
    1.39 +  second = snapshotWindow(iframeelem.contentWindow, false);
    1.40 +
    1.41 +  // We must have loaded the image again, because the principals for the
    1.42 +  // loading document are different.
    1.43 +  [correct, val1, val2] = compareSnapshots(first, second, false);
    1.44 +  ok(correct, "Image should have changed after changing the iframe's src.");
    1.45 +
    1.46 +  iframeelem.onload = snapshotThird;
    1.47 +  iframeelem.src = "http://mochi.test:8888/tests/image/test/mochitest/bug671906-iframe.html";
    1.48 +}
    1.49 +
    1.50 +function snapshotThird()
    1.51 +{
    1.52 +  var iframeelem = document.getElementById('test-iframe');
    1.53 +  third = snapshotWindow(iframeelem.contentWindow, false);
    1.54 +
    1.55 +  // We must have loaded the image again, because the principals for the
    1.56 +  // loading document are different.
    1.57 +  [correct, val1, val2] = compareSnapshots(second, third, false);
    1.58 +  ok(correct, "Image should have changed after changing the iframe's src.");
    1.59 +
    1.60 +  // We must have looped back to the first image, because the sjs only sends
    1.61 +  // one of two images.
    1.62 +  [correct, val1, val2] = compareSnapshots(first, third, true);
    1.63 +  ok(correct, "Image should be the same on the third load.");
    1.64 +
    1.65 +  SimpleTest.finish();
    1.66 +}
    1.67 +
    1.68 +</script>
    1.69 +</pre>
    1.70 +<div id="content"> <!-- style="display: none" -->
    1.71 +<iframe id="test-iframe" src="http://mochi.test:8888/tests/image/test/mochitest/bug671906-iframe.html" onload="snapshotFirst()"></iframe>
    1.72 +</div>
    1.73 +</body>
    1.74 +</html>

mercurial