image/test/mochitest/test_bug671906.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=671906
     5 -->
     6 <head>
     7   <title>Test for Bug 671906</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=671906">Mozilla Bug 671906</a>
    15 <p id="display"></p>
    16 <pre id="test">
    17 <script type="application/javascript">
    19 var first, second, third;
    20 var correct, val1, val2;
    22 SimpleTest.waitForExplicitFinish();
    24 function snapshotFirst()
    25 {
    26   var iframeelem = document.getElementById('test-iframe');
    27   first = snapshotWindow(iframeelem.contentWindow, false);
    29   iframeelem.onload = snapshotSecond;
    30   iframeelem.src = "http://example.com/tests/image/test/mochitest/bug671906-iframe.html";
    31 }
    33 function snapshotSecond()
    34 {
    35   var iframeelem = document.getElementById('test-iframe');
    36   second = snapshotWindow(iframeelem.contentWindow, false);
    38   // We must have loaded the image again, because the principals for the
    39   // loading document are different.
    40   [correct, val1, val2] = compareSnapshots(first, second, false);
    41   ok(correct, "Image should have changed after changing the iframe's src.");
    43   iframeelem.onload = snapshotThird;
    44   iframeelem.src = "http://mochi.test:8888/tests/image/test/mochitest/bug671906-iframe.html";
    45 }
    47 function snapshotThird()
    48 {
    49   var iframeelem = document.getElementById('test-iframe');
    50   third = snapshotWindow(iframeelem.contentWindow, false);
    52   // We must have loaded the image again, because the principals for the
    53   // loading document are different.
    54   [correct, val1, val2] = compareSnapshots(second, third, false);
    55   ok(correct, "Image should have changed after changing the iframe's src.");
    57   // We must have looped back to the first image, because the sjs only sends
    58   // one of two images.
    59   [correct, val1, val2] = compareSnapshots(first, third, true);
    60   ok(correct, "Image should be the same on the third load.");
    62   SimpleTest.finish();
    63 }
    65 </script>
    66 </pre>
    67 <div id="content"> <!-- style="display: none" -->
    68 <iframe id="test-iframe" src="http://mochi.test:8888/tests/image/test/mochitest/bug671906-iframe.html" onload="snapshotFirst()"></iframe>
    69 </div>
    70 </body>
    71 </html>

mercurial