https://github.com/mozilla/gecko-dev
Raw File
Tip revision: 39ff442a68b35e2412bd3f81a1fe0046dbad56a1 authored by ffxbld on 04 April 2012, 03:40:54 UTC
Added FENNEC_12_0b4_RELEASE FENNEC_12_0b4_BUILD1 tag(s) for changeset a8e7d1956aa3. DONTBUILD CLOSED TREE a=release
Tip revision: 39ff442
test_bug114649.html
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=114649
-->
<head>
  <title>Test for Bug 114649</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="run()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=114649">Mozilla Bug 114649</a>
<iframe id="display" style="width: 500px; height: 500px;"></iframe>
<pre id="test">
<script type="application/javascript">

/** Test for Bug 114649 **/

var gIFrame;
var gCurrentWidth = 500;
var gGotEventsAt = [];
var gInterval;

function run() {
    SimpleTest.waitForExplicitFinish();

    gIFrame = document.getElementById("display");

    var subdoc = gIFrame.contentDocument;
    subdoc.open();
    subdoc.write("<body onresize='window.parent.handle_child_resize()'>");
    subdoc.close();

    gInterval = window.setInterval(do_a_resize, 50);
}

function do_a_resize()
{
    // decrease the width by 10 until we hit 400, then stop
    gCurrentWidth -= 10;
    gIFrame.style.width = gCurrentWidth + "px";

    if (gCurrentWidth == 400) {
        window.clearInterval(gInterval);
        window.setTimeout(check_for_resize_events, 250);
        return;
    }
}

function handle_child_resize()
{
    gGotEventsAt.push(gCurrentWidth);
}

function check_for_resize_events()
{
	ok(gGotEventsAt.length >= 2, "got continuous events");
	isnot(gGotEventsAt[0], 400, "got continuous events");
	is(gGotEventsAt[gGotEventsAt.length - 1], 400, "got last event");
	SimpleTest.finish();
}

</script>
</pre>
</body>
</html>
back to top