Bug 1579031 - Implement browserAction.openPopup. r=darktrojan a=jorgk
authorPhilipp Kewisch <mozilla@kewis.ch>
Tue, 24 Sep 2019 14:06:50 +0200
changeset 36698 243c7a6e29436b4e09e06fc8b0aa57ce3ca445b7
parent 36697 0e203dc1c0338a650d2fe3b2aed097cfadfdf7f7
child 36699 da7293d2585079af2a9e4a89d6e211274d93c405
push id394
push userclokep@gmail.com
push dateMon, 21 Oct 2019 20:22:01 +0000
reviewersdarktrojan, jorgk
bugs1579031
Bug 1579031 - Implement browserAction.openPopup. r=darktrojan a=jorgk
mail/components/extensions/ExtensionToolbarButtons.jsm
mail/components/extensions/parent/ext-browserAction.js
mail/components/extensions/parent/ext-composeAction.js
--- a/mail/components/extensions/ExtensionToolbarButtons.jsm
+++ b/mail/components/extensions/ExtensionToolbarButtons.jsm
@@ -621,14 +621,15 @@ this.ToolbarButtonAPI = class extends Ex
         },
 
         getBadgeBackgroundColor(details, callback) {
           let color = action.getProperty(details, "badgeBackgroundColor");
           return color || [0xd9, 0, 0, 255];
         },
 
         openPopup() {
-          throw new Error("Not implemented");
+          let window = action.global.windowTracker.topWindow;
+          action.triggerAction(window);
         },
       },
     };
   }
 };
--- a/mail/components/extensions/parent/ext-browserAction.js
+++ b/mail/components/extensions/parent/ext-browserAction.js
@@ -50,12 +50,13 @@ this.browserAction = class extends Toolb
 
   constructor(extension) {
     super(extension);
     this.manifest_name = "browser_action";
     this.manifestName = "browserAction";
     this.windowURLs = ["chrome://messenger/content/messenger.xul"];
     this.toolboxId = "mail-toolbox";
     this.toolbarId = "mail-bar3";
+    this.global = global;
   }
 };
 
 global.browserActionFor = this.browserAction.for;
--- a/mail/components/extensions/parent/ext-composeAction.js
+++ b/mail/components/extensions/parent/ext-composeAction.js
@@ -20,16 +20,18 @@ this.composeAction = class extends Toolb
     let format =
       extension.manifest.compose_action.default_area == "formattoolbar";
     this.toolboxId = format ? "FormatToolbox" : "compose-toolbox";
     this.toolbarId = format ? "FormatToolbar" : "composeToolbar2";
 
     if (format) {
       this.paint = this.paintFormatToolbar;
     }
+
+    this.global = global;
   }
 
   paintFormatToolbar(window) {
     let { document } = window;
     if (document.getElementById(this.id)) {
       return;
     }