test_bug552605-1.html (1480B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=552605 5 --> 6 <head> 7 <title>Test for Bug 552605</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=552605">Mozilla Bug 552605</a> 14 <p id="display"></p> 15 <pre id="test"> 16 <script type="application/javascript"> 17 18 var first, second; 19 20 SimpleTest.waitForExplicitFinish(); 21 22 function checkFirst() 23 { 24 var testimage = document.getElementById('test-image'); 25 first = document.createElement('canvas') 26 var ctx = first.getContext('2d'); 27 ctx.drawImage(testimage, 0, 0); 28 29 var newimg = new Image(); 30 newimg.onload = checkSecond; 31 newimg.src = "bug552605.sjs"; 32 document.body.appendChild(newimg); 33 } 34 35 function checkSecond() 36 { 37 var testimage = document.getElementById('test-image'); 38 second = document.createElement('canvas') 39 var ctx = second.getContext('2d'); 40 ctx.drawImage(testimage, 0, 0); 41 42 // Check that the images are the same, since they're in the same document. 43 var values = compareSnapshots(first, second, true); 44 ok(values[0], "Image should be the same for all loads."); 45 46 SimpleTest.finish(); 47 } 48 49 </script> 50 </pre> 51 <div id="content"> <!-- style="display: none" --> 52 <img src="bug552605.sjs" onload="checkFirst()" id="test-image"></iframe> 53 </div> 54 </body> 55 </html>