1338772-1.html (1411B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <script> 4 function loadHandler() { 5 var outer = document.getElementById("outer"); 6 var inner = document.createElement("iframe"); 7 inner.height = "1px"; 8 outer.contentDocument.body.appendChild(inner); 9 10 // Flush reflow inside our inner iframe. This ensures that our inner.height 11 // tweak further down will actually invoke the resize handler. 12 inner.contentWindow.offsetTop; 13 14 // Set up resize handler (which ends the test, one way or another) 15 inner.contentWindow.onresize = () => { 16 outer.remove(); 17 document.documentElement.removeAttribute("class"); 18 }; 19 20 // Trigger the resize handler: 21 inner.height = "5px"; 22 inner.offsetTop; 23 } 24 25 // This function is a hack to avoid sporadic test-failures with... 26 // "...timed out waiting for reftest-wait to be removed". 27 // Occasionally, it seems this test loses a race condition of some sort, and 28 // its resize handler isn't invoked. When that happens (and specifically, when 29 // the test runs for longer than 500ms), we clear reftest-wait and call the 30 // run a "pass" (which is kind of valid, because we didn't crash!) and move on. 31 function setupFailsafe() { 32 setTimeout(() => { 33 document.documentElement.removeAttribute("class"); 34 }, 500); 35 } 36 </script> 37 <body onload="setupFailsafe()"> 38 <iframe id="outer" 39 src="data:text/html,<html><body>" 40 onload="loadHandler()"> 41 </iframe> 42 </body>