summaryrefslogtreecommitdiffstats
path: root/browser/components/extensions/test/browser/browser_ext_sidebarAction_click.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/extensions/test/browser/browser_ext_sidebarAction_click.js')
-rw-r--r--browser/components/extensions/test/browser/browser_ext_sidebarAction_click.js74
1 files changed, 74 insertions, 0 deletions
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": `
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8">
+ </head>
+ <script src="panel.js" type="text/javascript"></script>
+ <a id="testlink" href="http://mochi.test:8888">Bugzilla</a>
+ </html>`,
+ "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();
+});