test_bug421602.html (1233B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=421602 5 --> 6 <head> 7 <title>Test for Bug 421602</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=421602">Mozilla Bug 421602</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script class="testbody" type="text/javascript"> 19 20 /** Test for Bug 421602 */ 21 SimpleTest.waitForExplicitFinish(); 22 23 var img1loaded = false; 24 var img1errored = false; 25 26 // Our test image 27 function loadTestImage() { 28 var img1 = new Image(); 29 img1.onload = function() { 30 img1loaded = true; 31 finishTest(); 32 } 33 img1.onerror = function() { 34 img1errored = true; 35 finishTest(); 36 } 37 img1.src = window.location.href + "?image1=true"; 38 } 39 loadTestImage(); 40 41 // Probably overkill to gc() more than once, but let's be safe 42 SpecialPowers.gc(); SpecialPowers.gc(); SpecialPowers.gc(); 43 44 function finishTest() { 45 is(img1errored, true, "Image 1 should error"); 46 is(img1loaded, false, "Image 1 should not load"); 47 SimpleTest.finish(); 48 } 49 </script> 50 </pre> 51 </body> 52 </html>