Bug 1617742 - Enable opening of composeAction popups by onBeforeSend listener. r=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 25 Feb 2020 10:43:55 +0200
changeset 37427 f34fd430a920b192011a843926cc975366c9df9d
parent 37426 56ae836a9049cc48094e3270560f98b0cc819225
child 37428 f31e6d1534440f26b7ebebab08e1db86227e2d8a
push id2566
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:20:31 +0000
treeherdercomm-beta@a352facfa0a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1617742
Bug 1617742 - Enable opening of composeAction popups by onBeforeSend listener. r=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
@@ -675,15 +675,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
@@ -224,16 +224,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
               );
             };