test_bug671906.html (2356B)
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 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=671906">Mozilla Bug 671906</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 async function snapshotFirst() 24 { 25 var iframeelem = document.getElementById('test-iframe'); 26 first = await SpecialPowers.wrap(snapshotWindow(iframeelem, false)); 27 28 iframeelem.onload = snapshotSecond; 29 iframeelem.src = "http://example.com/tests/image/test/mochitest/bug671906-iframe.html"; 30 } 31 32 async function snapshotSecond() 33 { 34 var iframeelem = document.getElementById('test-iframe'); 35 second = await SpecialPowers.wrap(snapshotWindow(iframeelem, false)); 36 37 // We must have loaded the image again, because the principals for the 38 // loading document are different. 39 [correct, val1, val2] = compareSnapshots(first, second, false); 40 ok(correct, "Image should have changed after changing the iframe's src."); 41 42 iframeelem.onload = snapshotThird; 43 iframeelem.src = "http://mochi.test:8888/tests/image/test/mochitest/bug671906-iframe.html"; 44 } 45 46 async function snapshotThird() 47 { 48 var iframeelem = document.getElementById('test-iframe'); 49 third = await SpecialPowers.wrap(snapshotWindow(iframeelem, false)); 50 51 // We must have loaded the image again, because the principals for the 52 // loading document are different. 53 [correct, val1, val2] = compareSnapshots(second, third, false); 54 ok(correct, "Image should have changed after changing the iframe's src."); 55 56 // We must have looped back to the first image, because the sjs only sends 57 // one of two images. 58 [correct, val1, val2] = compareSnapshots(first, third, true); 59 ok(correct, "Image should be the same on the third load."); 60 61 SimpleTest.finish(); 62 } 63 64 </script> 65 </pre> 66 <div id="content"> <!-- style="display: none" --> 67 <iframe id="test-iframe" src="http://mochi.test:8888/tests/image/test/mochitest/bug671906-iframe.html" onload="snapshotFirst()"></iframe> 68 </div> 69 </body> 70 </html>