test_bug89419-1.html (1929B)
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 src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/WindowSnapshot.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=89419">Mozilla Bug 89419</a> 14 <p id="display"></p> 15 <pre id="test"> 16 <script type="application/javascript"> 17 18 var first, second, third; 19 var correct, val1, val2; 20 21 SimpleTest.waitForExplicitFinish(); 22 23 function checkFirst() 24 { 25 var iframeelem = document.getElementById('test-iframe'); 26 first = snapshotWindow(iframeelem.contentWindow, false); 27 28 iframeelem.onload = checkSecond; 29 iframeelem.contentWindow.location.reload(false); 30 } 31 32 function checkSecond() 33 { 34 var iframeelem = document.getElementById('test-iframe'); 35 second = snapshotWindow(iframeelem.contentWindow, false); 36 37 // Check that we actually reloaded. 38 [correct, val1, val2] = compareSnapshots(first, second, false); 39 ok(correct, "Image should have changed after the first reload."); 40 41 iframeelem.onload = checkThird; 42 iframeelem.contentWindow.location.reload(false); 43 } 44 45 function checkThird() 46 { 47 var iframeelem = document.getElementById('test-iframe'); 48 third = snapshotWindow(iframeelem.contentWindow, false); 49 50 // Check that we actually reloaded. 51 [correct, val1, val2] = compareSnapshots(second, third, false); 52 ok(correct, "Image should have changed after the second reload."); 53 54 // Make sure we looped back to the first image. 55 [correct, val1, val2] = compareSnapshots(first, third, true); 56 ok(correct, "Third image should match first image."); 57 58 SimpleTest.finish(); 59 } 60 61 </script> 62 </pre> 63 <div id="content"> <!-- style="display: none" --> 64 <iframe id="test-iframe" src="bug89419-iframe.html" onload="checkFirst()"></iframe> 65 </div> 66 </body> 67 </html>