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 /toolkit/content/tests/browser/browser_starting_autoscroll_in_about_content.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/content/tests/browser/browser_starting_autoscroll_in_about_content.js')
-rw-r--r-- | toolkit/content/tests/browser/browser_starting_autoscroll_in_about_content.js | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/toolkit/content/tests/browser/browser_starting_autoscroll_in_about_content.js b/toolkit/content/tests/browser/browser_starting_autoscroll_in_about_content.js new file mode 100644 index 0000000000..f0daa480d4 --- /dev/null +++ b/toolkit/content/tests/browser/browser_starting_autoscroll_in_about_content.js @@ -0,0 +1,74 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function testStartingAutoScrollInAboutContent() { + await SpecialPowers.pushPrefEnv({ + set: [ + ["general.autoScroll", true], + ["middlemouse.contentLoadURL", false], + ["test.events.async.enabled", true], + ], + }); + + await BrowserTestUtils.withNewTab("about:support", async function (browser) { + let autoScroller; + let promiseStartAutoScroll = new Promise(resolve => { + let onPopupShown = event => { + if (event.originalTarget.id != "autoscroller") { + return; + } + autoScroller = event.originalTarget; + info('"popupshown" event is fired'); + autoScroller.getBoundingClientRect(); // Flush layout of the autoscroller + resolve(); + }; + window.addEventListener("popupshown", onPopupShown, { capture: true }); + registerCleanupFunction(() => { + window.removeEventListener("popupshown", onPopupShown, { + capture: true, + }); + }); + }); + + ok(!browser.isRemoteBrowser, "Browser should not be remote."); + await ContentTask.spawn(browser, null, async function () { + await ContentTaskUtils.waitForCondition( + () => + content.document.documentElement.scrollHeight > + content.document.documentElement.clientHeight, + "The document should become scrollable" + ); + }); + + await EventUtils.promiseNativeMouseEvent({ + type: "mousemove", + target: browser, + offsetX: 10, + offsetY: 10, // XXX Assuming that there is no interactive content here. + }); + await EventUtils.promiseNativeMouseEvent({ + type: "mousedown", + button: 1, // middle click + target: browser, + offsetX: 10, + offsetY: 10, + }); + info("Waiting to start autoscrolling"); + await promiseStartAutoScroll; + ok(autoScroller != null, "Autoscrolling should be started"); + await EventUtils.promiseNativeMouseEvent({ + type: "mouseup", + button: 1, // middle click + target: browser, + offsetX: 10, + offsetY: 10, + }); // release implicit capture + EventUtils.synthesizeKey("KEY_Escape"); // Close autoscroller + await TestUtils.waitForCondition( + () => autoScroller.state == "closed", + "autoscroll should be canceled" + ); + }); +}); |