test_reentrant_flush.html (1649B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=709256 5 --> 6 <head> 7 <title>Test for Bug 709256</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=709256">Mozilla Bug 709256</a> 13 <p id="display"> 14 <iframe id="test" 15 style="width: 100px" srcdoc="<body style='width: 100%'>"> 16 </iframe> 17 </p> 18 <div id="content" style="display: none"> 19 20 </div> 21 <pre id="test"> 22 <script type="application/javascript"> 23 24 /** Test for Bug 709256 */ 25 SimpleTest.waitForExplicitFinish(); 26 addLoadEvent(function() { 27 var ifr = $("test"); 28 var bod = ifr.contentDocument.body; 29 30 is(bod.getBoundingClientRect().width, 100, 31 "Width of body should be 100px to start with"); 32 33 var resizeHandlerRan = false; 34 35 function handleResize() { 36 resizeHandlerRan = true; 37 is(bod.getBoundingClientRect().width, 50, 38 "Width of body should now be 50px"); 39 } 40 41 var win = ifr.contentWindow; 42 43 win.addEventListener("resize", handleResize); 44 SpecialPowers.setFullZoom(win, 2); 45 46 is(resizeHandlerRan, false, 47 "Resize handler should not have run yet for this test to be valid"); 48 49 // Now flush out layout on the subdocument, to trigger the resize handler 50 is(bod.getBoundingClientRect().width, 50, "Width of body should still be 50px"); 51 window.requestAnimationFrame(function() { 52 is(resizeHandlerRan, true, "Resize handler should have run"); 53 win.removeEventListener("resize", handleResize); 54 SimpleTest.finish(); 55 }); 56 }); 57 </script> 58 </pre> 59 </body> 60 </html>