1634839-2.html (1229B)
1 <!DOCTYPE HTML> 2 <html class="reftest-wait"> 3 <head> 4 </head> 5 <body> 6 <div id="container"> 7 <iframe id='if' src="1634839-2-iframe.html"></iframe> 8 </div> 9 10 <script> 11 let iterationsLeft = 1; 12 13 let img = null; 14 15 function runTest() { 16 // Make sure the image is decoded and advanced to it's final frame. 17 img = document.getElementById("if").contentWindow.document.getElementById("image1"); 18 img.decode().then(function() { 19 setTimeout(forceDiscard, 1000); 20 }); 21 } 22 23 function showIframe() { 24 document.getElementById("container").style.display = ""; 25 document.documentElement.getBoundingClientRect(); 26 requestAnimationFrame(forceDecode); 27 } 28 29 function forceDecode() { 30 img.decode().then(function() { 31 setTimeout(forceDiscard, 0); 32 }); 33 } 34 35 function forceDiscard() { 36 iterationsLeft--; 37 if (iterationsLeft < 0) { 38 document.documentElement.className = ""; 39 return; 40 } 41 document.getElementById("container").style.display = "none"; 42 document.documentElement.getBoundingClientRect(); 43 img.remove(); 44 requestAnimationFrame(() => { requestAnimationFrame( () => { setTimeout(showIframe, 0); } ) }); 45 } 46 47 //window.addEventListener("load", runTest); 48 window.addEventListener("MozReftestInvalidate", runTest); 49 </script> 50 </body> 51 </html>