content/base/test/test_reentrant_flush.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial