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/browser_bug617076.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.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/browser_bug617076.js')
-rw-r--r-- | layout/base/tests/browser_bug617076.js | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/layout/base/tests/browser_bug617076.js b/layout/base/tests/browser_bug617076.js new file mode 100644 index 0000000000..c76cbd41d3 --- /dev/null +++ b/layout/base/tests/browser_bug617076.js @@ -0,0 +1,71 @@ +/** + * 1. load about:addons in a new tab and select that tab + * 2. insert a button with tooltiptext + * 3. create a new blank tab and select that tab + * 4. select the about:addons tab and hover the inserted button + * 5. remove the about:addons tab + * 6. remove the blank tab + * + * the test succeeds if it doesn't trigger any assertions + */ + +add_task(async function test() { + // Open the test tab + let testTab = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + "about:addons" + ); + + // insert button into test page content + await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () { + let doc = content.document; + let e = doc.createXULElement("button"); + e.setAttribute("label", "hello"); + e.setAttribute("tooltiptext", "world"); + e.setAttribute("id", "test-button"); + doc.documentElement.insertBefore(e, doc.documentElement.firstChild); + }); + + // open a second tab and select it + let tab2 = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + "about:blank", + true + ); + gBrowser.selectedTab = tab2; + + // Select the testTab then perform mouse events on inserted button + gBrowser.selectedTab = testTab; + let browser = gBrowser.selectedBrowser; + EventUtils.disableNonTestMouseEvents(true); + try { + await BrowserTestUtils.synthesizeMouse( + "#test-button", + 1, + 1, + { type: "mouseover" }, + browser + ); + await BrowserTestUtils.synthesizeMouse( + "#test-button", + 2, + 6, + { type: "mousemove" }, + browser + ); + await BrowserTestUtils.synthesizeMouse( + "#test-button", + 2, + 4, + { type: "mousemove" }, + browser + ); + } finally { + EventUtils.disableNonTestMouseEvents(false); + } + + // cleanup + BrowserTestUtils.removeTab(testTab); + BrowserTestUtils.removeTab(tab2); + ok(true, "pass if no assertions"); +}); |