test_bug89419-2.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. var first, second, third;
  19. var correct, val1, val2;
  20. SimpleTest.waitForExplicitFinish();
  21. function checkFirst()
  22. {
  23. var iframeelem = document.getElementById('test-iframe');
  24. first = snapshotWindow(iframeelem.contentWindow, false);
  25. iframeelem.onload = checkSecond;
  26. iframeelem.contentWindow.location.href = iframeelem.contentWindow.location.href;
  27. }
  28. function checkSecond()
  29. {
  30. var iframeelem = document.getElementById('test-iframe');
  31. second = snapshotWindow(iframeelem.contentWindow, false);
  32. // Check that we actually reloaded.
  33. [correct, val1, val2] = compareSnapshots(first, second, false);
  34. ok(correct, "Image should have changed after the first reload.");
  35. iframeelem.onload = checkThird;
  36. iframeelem.contentWindow.location.href = iframeelem.contentWindow.location.href;
  37. }
  38. function checkThird()
  39. {
  40. var iframeelem = document.getElementById('test-iframe');
  41. third = snapshotWindow(iframeelem.contentWindow, false);
  42. // Check that we actually reloaded.
  43. [correct, val1, val2] = compareSnapshots(second, third, false);
  44. ok(correct, "Image should have changed after the second reload.");
  45. // Make sure we looped back to the first image.
  46. [correct, val1, val2] = compareSnapshots(first, third, true);
  47. ok(correct, "Third image should match first image.");
  48. SimpleTest.finish();
  49. }
  50. </script>
  51. </pre>
  52. <div id="content"> <!-- style="display: none" -->
  53. <iframe id="test-iframe" src="bug89419-iframe.html" onload="checkFirst()"></iframe>
  54. </div>
  55. </body>
  56. </html>