layout/base/tests/test_bug114649.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/test_bug114649.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,66 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=114649
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 114649</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 onload="run()">
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=114649">Mozilla Bug 114649</a>
    1.16 +<iframe id="display" style="width: 500px; height: 500px;"></iframe>
    1.17 +<pre id="test">
    1.18 +<script type="application/javascript">
    1.19 +
    1.20 +/** Test for Bug 114649 **/
    1.21 +
    1.22 +var gIFrame;
    1.23 +var gCurrentWidth = 500;
    1.24 +var gGotEventsAt = [];
    1.25 +var gInterval;
    1.26 +
    1.27 +function run() {
    1.28 +    SimpleTest.waitForExplicitFinish();
    1.29 +
    1.30 +    gIFrame = document.getElementById("display");
    1.31 +
    1.32 +    var subdoc = gIFrame.contentDocument;
    1.33 +    subdoc.open();
    1.34 +    subdoc.write("<body onresize='window.parent.handle_child_resize()'>");
    1.35 +    subdoc.close();
    1.36 +
    1.37 +    gInterval = window.setInterval(do_a_resize, 50);
    1.38 +}
    1.39 +
    1.40 +function do_a_resize()
    1.41 +{
    1.42 +    // decrease the width by 10 until we hit 400, then stop
    1.43 +    gCurrentWidth -= 10;
    1.44 +    gIFrame.style.width = gCurrentWidth + "px";
    1.45 +
    1.46 +    if (gCurrentWidth == 400) {
    1.47 +        window.clearInterval(gInterval);
    1.48 +        window.setTimeout(check_for_resize_events, 250);
    1.49 +        return;
    1.50 +    }
    1.51 +}
    1.52 +
    1.53 +function handle_child_resize()
    1.54 +{
    1.55 +    gGotEventsAt.push(gCurrentWidth);
    1.56 +}
    1.57 +
    1.58 +function check_for_resize_events()
    1.59 +{
    1.60 +	ok(gGotEventsAt.length >= 2, "got continuous events");
    1.61 +	isnot(gGotEventsAt[0], 400, "got continuous events");
    1.62 +	is(gGotEventsAt[gGotEventsAt.length - 1], 400, "got last event");
    1.63 +	SimpleTest.finish();
    1.64 +}
    1.65 +
    1.66 +</script>
    1.67 +</pre>
    1.68 +</body>
    1.69 +</html>

mercurial