Bug 1617742 - Enable opening of composeAction popups by onBeforeSend listener. r+a=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 25 Feb 2020 10:43:55 +0200
changeset 38183 2aeba9647436e354e4e61bf3e37f492e0728dafa
parent 38182 181293f406d7683dd257aba18d32a89528fca0eb
child 38184 aade030db497ef2b73acf128dbdbefa2799a732e
push id398
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:10:28 +0000
bugs1617742
Bug 1617742 - Enable opening of composeAction popups by onBeforeSend listener. r+a=mkmelin
mail/components/extensions/ExtensionToolbarButtons.jsm
mail/components/extensions/parent/ext-compose.js
--- a/mail/components/extensions/ExtensionToolbarButtons.jsm
+++ b/mail/components/extensions/ExtensionToolbarButtons.jsm
@@ -642,15 +642,17 @@ this.ToolbarButtonAPI = class extends Ex
         },
 
         getBadgeBackgroundColor(details, callback) {
           let color = action.getProperty(details, "badgeBackgroundColor");
           return color || [0xd9, 0, 0, 255];
         },
 
         openPopup() {
-          let window = action.global.windowTracker.topWindow;
-          action.triggerAction(window);
+          let window = Services.wm.getMostRecentWindow("");
+          if (action.windowURLs.includes(window.location.href)) {
+            action.triggerAction(window);
+          }
         },
       },
     };
   }
 };
--- a/mail/components/extensions/parent/ext-compose.js
+++ b/mail/components/extensions/parent/ext-compose.js
@@ -205,16 +205,17 @@ this.compose = class extends ExtensionAP
 
     let { extension } = context;
     let { tabManager, windowManager } = extension;
     return {
       compose: {
         onBeforeSend: new EventManager({
           context,
           name: "compose.onBeforeSend",
+          inputHandling: true,
           register: fire => {
             let listener = (event, window, details) => {
               let win = windowManager.wrapWindow(window);
               return fire.async(
                 tabManager.convert(win.activeTab.nativeTab),
                 details
               );
             };