summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/tabs/browser_contextmenu_openlink_after_tabnavigated.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /browser/base/content/test/tabs/browser_contextmenu_openlink_after_tabnavigated.js
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/tabs/browser_contextmenu_openlink_after_tabnavigated.js')
-rw-r--r--browser/base/content/test/tabs/browser_contextmenu_openlink_after_tabnavigated.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/browser/base/content/test/tabs/browser_contextmenu_openlink_after_tabnavigated.js b/browser/base/content/test/tabs/browser_contextmenu_openlink_after_tabnavigated.js
new file mode 100644
index 0000000000..3ce653cafc
--- /dev/null
+++ b/browser/base/content/test/tabs/browser_contextmenu_openlink_after_tabnavigated.js
@@ -0,0 +1,60 @@
+"use strict";
+
+const example_base =
+ // eslint-disable-next-line @microsoft/sdl/no-insecure-url
+ "http://example.com/browser/browser/base/content/test/tabs/";
+
+add_task(async function test_contextmenu_openlink_after_tabnavigated() {
+ let url = example_base + "test_bug1358314.html";
+
+ const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
+
+ const contextMenu = document.getElementById("contentAreaContextMenu");
+ let awaitPopupShown = BrowserTestUtils.waitForEvent(
+ contextMenu,
+ "popupshown"
+ );
+ await BrowserTestUtils.synthesizeMouse(
+ "a",
+ 0,
+ 0,
+ {
+ type: "contextmenu",
+ button: 2,
+ },
+ gBrowser.selectedBrowser
+ );
+ await awaitPopupShown;
+ info("Popup Shown");
+
+ info("Navigate the tab with the opened context menu");
+ BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, "about:blank");
+ await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
+
+ let awaitNewTabOpen = BrowserTestUtils.waitForNewTab(
+ gBrowser,
+ // eslint-disable-next-line @microsoft/sdl/no-insecure-url
+ "http://example.com/",
+ true
+ );
+
+ info("Click the 'open link in new tab' menu item");
+ let openLinkMenuItem = contextMenu.querySelector("#context-openlinkintab");
+ contextMenu.activateItem(openLinkMenuItem);
+
+ info("Wait for the new tab to be opened");
+ const newTab = await awaitNewTabOpen;
+
+ // Close the contextMenu popup if it has not been closed yet.
+ contextMenu.hidePopup();
+
+ is(
+ newTab.linkedBrowser.currentURI.spec,
+ // eslint-disable-next-line @microsoft/sdl/no-insecure-url
+ "http://example.com/",
+ "Got the expected URL loaded in the new tab"
+ );
+
+ BrowserTestUtils.removeTab(newTab);
+ BrowserTestUtils.removeTab(tab);
+});