layout/base/tests/test_bug114649.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=114649
     5 -->
     6 <head>
     7   <title>Test for Bug 114649</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body onload="run()">
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=114649">Mozilla Bug 114649</a>
    13 <iframe id="display" style="width: 500px; height: 500px;"></iframe>
    14 <pre id="test">
    15 <script type="application/javascript">
    17 /** Test for Bug 114649 **/
    19 var gIFrame;
    20 var gCurrentWidth = 500;
    21 var gGotEventsAt = [];
    22 var gInterval;
    24 function run() {
    25     SimpleTest.waitForExplicitFinish();
    27     gIFrame = document.getElementById("display");
    29     var subdoc = gIFrame.contentDocument;
    30     subdoc.open();
    31     subdoc.write("<body onresize='window.parent.handle_child_resize()'>");
    32     subdoc.close();
    34     gInterval = window.setInterval(do_a_resize, 50);
    35 }
    37 function do_a_resize()
    38 {
    39     // decrease the width by 10 until we hit 400, then stop
    40     gCurrentWidth -= 10;
    41     gIFrame.style.width = gCurrentWidth + "px";
    43     if (gCurrentWidth == 400) {
    44         window.clearInterval(gInterval);
    45         window.setTimeout(check_for_resize_events, 250);
    46         return;
    47     }
    48 }
    50 function handle_child_resize()
    51 {
    52     gGotEventsAt.push(gCurrentWidth);
    53 }
    55 function check_for_resize_events()
    56 {
    57 	ok(gGotEventsAt.length >= 2, "got continuous events");
    58 	isnot(gGotEventsAt[0], 400, "got continuous events");
    59 	is(gGotEventsAt[gGotEventsAt.length - 1], 400, "got last event");
    60 	SimpleTest.finish();
    61 }
    63 </script>
    64 </pre>
    65 </body>
    66 </html>

mercurial