1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_reentrant_flush.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=709256 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 709256</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=709256">Mozilla Bug 709256</a> 1.16 +<p id="display"> 1.17 +<iframe id="test" 1.18 + style="width: 100px" src="data:text/html,<body style='width: 100%'>"> 1.19 +</iframe> 1.20 +</p> 1.21 +<div id="content" style="display: none"> 1.22 + 1.23 +</div> 1.24 +<pre id="test"> 1.25 +<script type="application/javascript"> 1.26 + 1.27 +/** Test for Bug 709256 **/ 1.28 +SimpleTest.waitForExplicitFinish(); 1.29 +addLoadEvent(function() { 1.30 + var ifr = $("test"); 1.31 + var bod = ifr.contentDocument.body; 1.32 + 1.33 + is(bod.getBoundingClientRect().width, 100, 1.34 + "Width of body should be 100px to start with"); 1.35 + 1.36 + var resizeHandlerRan = false; 1.37 + 1.38 + function handleResize() { 1.39 + resizeHandlerRan = true; 1.40 + is(bod.getBoundingClientRect().width, 50, 1.41 + "Width of body should now be 50px"); 1.42 + } 1.43 + 1.44 + var win = ifr.contentWindow; 1.45 + 1.46 + win.addEventListener("resize", handleResize, false); 1.47 + SpecialPowers.setFullZoom(win, 2); 1.48 + 1.49 + is(resizeHandlerRan, false, 1.50 + "Resize handler should not have run yet for this test to be valid"); 1.51 + 1.52 + // Now flush out layout on the subdocument, to trigger the resize handler 1.53 + is(bod.getBoundingClientRect().width, 50, "Width of body should still be 50px"); 1.54 + 1.55 + is(resizeHandlerRan, true, "Resize handler should have run"); 1.56 + 1.57 + win.removeEventListener("resize", handleResize, false); 1.58 + 1.59 + SimpleTest.finish(); 1.60 +}); 1.61 +</script> 1.62 +</pre> 1.63 +</body> 1.64 +</html>