From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../browser/browser_ext_sidebarAction_click.js | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 browser/components/extensions/test/browser/browser_ext_sidebarAction_click.js (limited to 'browser/components/extensions/test/browser/browser_ext_sidebarAction_click.js') diff --git a/browser/components/extensions/test/browser/browser_ext_sidebarAction_click.js b/browser/components/extensions/test/browser/browser_ext_sidebarAction_click.js new file mode 100644 index 0000000000..621d2d1180 --- /dev/null +++ b/browser/components/extensions/test/browser/browser_ext_sidebarAction_click.js @@ -0,0 +1,74 @@ +/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set sts=2 sw=2 et tw=80: */ +"use strict"; + +add_task(async function test_sidebar_click_isAppTab_behavior() { + function sidebarScript() { + browser.tabs.onUpdated.addListener(function onUpdated( + tabId, + changeInfo, + tab + ) { + if ( + changeInfo.status == "complete" && + tab.url == "http://mochi.test:8888/" + ) { + browser.tabs.remove(tab.id); + browser.test.notifyPass("sidebar-click"); + } + }); + window.addEventListener( + "load", + () => { + browser.test.sendMessage("sidebar-ready"); + }, + { once: true } + ); + } + + let extension = ExtensionTestUtils.loadExtension({ + manifest: { + sidebar_action: { + default_panel: "panel.html", + browser_style: false, + }, + permissions: ["tabs"], + }, + useAddonManager: "temporary", + + files: { + "panel.html": ` + + + + + + + Bugzilla + `, + "panel.js": sidebarScript, + }, + }); + + await extension.startup(); + await extension.awaitMessage("sidebar-ready"); + + // This test fails if docShell.isAppTab has not been set to true. + let content = SidebarUI.browser.contentWindow; + + // Wait for the layout to be flushed, otherwise this test may + // fail intermittently if synthesizeMouseAtCenter is being called + // while the sidebar is still opening and the browser window layout + // being recomputed. + await content.promiseDocumentFlushed(() => {}); + + info("Clicking link in extension sidebar"); + await BrowserTestUtils.synthesizeMouseAtCenter( + "#testlink", + {}, + content.gBrowser.selectedBrowser + ); + await extension.awaitFinish("sidebar-click"); + + await extension.unload(); +}); -- cgit v1.2.3