layout/base/tests/test_bug114649.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:412f62fbebcf
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">
16
17 /** Test for Bug 114649 **/
18
19 var gIFrame;
20 var gCurrentWidth = 500;
21 var gGotEventsAt = [];
22 var gInterval;
23
24 function run() {
25 SimpleTest.waitForExplicitFinish();
26
27 gIFrame = document.getElementById("display");
28
29 var subdoc = gIFrame.contentDocument;
30 subdoc.open();
31 subdoc.write("<body onresize='window.parent.handle_child_resize()'>");
32 subdoc.close();
33
34 gInterval = window.setInterval(do_a_resize, 50);
35 }
36
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";
42
43 if (gCurrentWidth == 400) {
44 window.clearInterval(gInterval);
45 window.setTimeout(check_for_resize_events, 250);
46 return;
47 }
48 }
49
50 function handle_child_resize()
51 {
52 gGotEventsAt.push(gCurrentWidth);
53 }
54
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 }
62
63 </script>
64 </pre>
65 </body>
66 </html>

mercurial