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