diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /layout/base/tests/test_bug114649.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/base/tests/test_bug114649.html')
-rw-r--r-- | layout/base/tests/test_bug114649.html | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/layout/base/tests/test_bug114649.html b/layout/base/tests/test_bug114649.html new file mode 100644 index 0000000000..765a3b069e --- /dev/null +++ b/layout/base/tests/test_bug114649.html @@ -0,0 +1,78 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=114649 +--> +<head> + <title>Test for Bug 114649</title> + <script 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; +var gFinished = false; + +function run() { + SimpleTest.waitForExplicitFinish(); + SimpleTest.requestFlakyTimeout("Simulating dragging to resize a window"); + + gIFrame = document.getElementById("display"); + + var subdoc = gIFrame.contentDocument; + subdoc.open(); + subdoc.write("<body onresize='window.parent.handle_resize_event()'>"); + subdoc.close(); + + setTimeout(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) { + setTimeout(do_a_resize, 50); + } +} + +function handle_resize_event() +{ + gGotEventsAt.push(gCurrentWidth); + + if (gCurrentWidth == 400) { + check_resize_events(); + } +} + +function check_resize_events() +{ + if (gFinished) { + // We can get here when the browser can't process the resizes and + // dispatch resize events as fast as we're doing the resizing. We can + // then end up with multiple resize events queued up after we set our + // final size. This return makes sure that in that case we avoid + // calling SimpleTest.finish() more than once. + return; + } + gFinished = true; + ok(gGotEventsAt.length >= 2, "We should get more than one event"); + isnot(gGotEventsAt[0], 400, "The first event shouldn't be for the final size"); + SimpleTest.finish(); +} + +</script> +</pre> +</body> +</html> |