test_intrinsic_size_on_loading.html (1750B)
1 <!DOCTYPE html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1205027 5 --> 6 <head> 7 <title>Test for images intrinsic size while load is pending</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 <style> 11 body { margin: 0; } 12 img { display: block; } 13 </style> 14 <script> 15 SimpleTest.waitForExplicitFinish(); 16 var initialOffsetTop; 17 var finalOffsetTop; 18 19 function report() { 20 finalOffsetTop = marker.offsetTop; 21 is(initialOffsetTop, 0, "initial offsetTop: " + initialOffsetTop); 22 is(finalOffsetTop, 8, "final offsetTop: " + finalOffsetTop); 23 ok(initialOffsetTop < finalOffsetTop, "offsetTop should get larger."); 24 SimpleTest.finish(); 25 } 26 27 function fail() { 28 ok(false, "image loading should not fail."); 29 } 30 </script> 31 </head> 32 <body onload="report();"> 33 <!-- Bunch of tiny images: --> 34 <img src="file_SlowImage.sjs" onerror="fail();"> 35 <img src="file_SlowImage.sjs" onerror="fail();"> 36 <img src="file_SlowImage.sjs" onerror="fail();"> 37 <img src="file_SlowImage.sjs" onerror="fail();"> 38 <img src="file_SlowImage.sjs" onerror="fail();"> 39 <img src="file_SlowImage.sjs" onerror="fail();"> 40 <img src="file_SlowImage.sjs" onerror="fail();"> 41 <img src="file_SlowImage.sjs" onerror="fail();"> 42 43 <div id="marker">Marker div</div> 44 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1205027">Mozilla Bug 1205027</a> 45 <script> 46 initialOffsetTop = marker.offsetTop; 47 // prompt the sjs "server" to proceed to serve data to our <img> elements 48 var img = new Image(); 49 img.onerror = fail; 50 img.src = "file_SlowImage.sjs?continue"; 51 </script> 52 </body> 53 </html>