Bug 1508217 - remove broadcasters from mail/base. r=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Tue, 20 Nov 2018 13:45:27 +0200
changeset 33747 72a2e97895e9d58585d4647fdb79f5d4010244d2
parent 33746 13244aeffef49855b7c5b6e67e78f0dae4ceacfc
child 33748 73d35ac1dec481f3e310a12d27ca420532f51b41
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersjorgk
bugs1508217, 1489447
Bug 1508217 - remove broadcasters from mail/base. r=jorgk Part of bug 1489447 - [meta] remove broadcasters in thunderbird related code.
mail/base/content/messageWindow.xul
mail/base/content/messenger.xul
mail/base/content/msgHdrView.inc
mail/base/content/msgHdrView.js
--- a/mail/base/content/messageWindow.xul
+++ b/mail/base/content/messageWindow.xul
@@ -137,20 +137,16 @@
     <commandset id="tasksCommands">
       <command id="cmd_newMessage" oncommand="goOpenNewMessage();"/>
       <command id="cmd_newCard" oncommand="openNewCardDialog()"/>
     </commandset>
     <commandset id="commandKeys"/>
     <command id="cmd_close" oncommand="window.close();"/>
   </commandset>
 
-  <broadcasterset id="otherActionsButtonBroadcasters">
-     <broadcaster id="otherActionsOpenIn"/>
-  </broadcasterset>
-
   <keyset id="mailKeys">
     <key keycode="VK_ESCAPE" oncommand="window.close();"/>
 #include mainKeySet.inc
     <keyset id="tasksKeys">
 #ifdef XP_MACOSX
       <key id="key_newMessage" key="&newMessageCmd.key;" command="cmd_newMessage"
            modifiers="accel,shift"/>
       <key id="key_newMessage2" key="&newMessageCmd2.key;" command="cmd_newMessage"
--- a/mail/base/content/messenger.xul
+++ b/mail/base/content/messenger.xul
@@ -195,20 +195,16 @@
         oncommandupdate="FocusRingUpdate_Mail()"/>
   <commandset id="tasksCommands">
     <command id="cmd_newMessage" oncommand="goOpenNewMessage();"/>
     <command id="cmd_newCard" oncommand="openNewCardDialog()"/>
   </commandset>
   <command id="cmd_close" oncommand="CloseTabOrWindow();"/>
 </commandset>
 
-<broadcasterset id="otherActionsButtonBroadcasters">
-   <broadcaster id="otherActionsOpenIn"/>
-</broadcasterset>
-
 <keyset id="mailKeys">
 #include mainKeySet.inc
   <keyset id="tasksKeys">
 #ifdef XP_MACOSX
     <key id="key_newMessage" key="&newMessageCmd.key;" command="cmd_newMessage"
          modifiers="accel,shift"/>
     <key id="key_newMessage2" key="&newMessageCmd2.key;" command="cmd_newMessage"
          modifiers="accel"/>
--- a/mail/base/content/msgHdrView.inc
+++ b/mail/base/content/msgHdrView.inc
@@ -213,22 +213,20 @@
                                         <menuitem id="otherActionsOpenConversation"
                                                   label="&otherActionsOpenConversation1.label;"
                                                   accesskey="&otherActionsOpenConversation1.accesskey;"
                                                   oncommand="gConversationOpener.openConversationForMessages(gFolderDisplay.selectedMessages);"/>
 #endif
                                         <menuitem id="otherActionsOpenInNewWindow"
                                                   label="&otherActionsOpenInNewWindow1.label;"
                                                   accesskey="&otherActionsOpenInNewWindow1.accesskey;"
-                                                  observes="otherActionsOpenIn"
                                                   oncommand="MsgOpenNewWindowForMessage();"/>
                                         <menuitem id="otherActionsOpenInNewTab"
                                                   label="&otherActionsOpenInNewTab1.label;"
                                                   accesskey="&otherActionsOpenInNewTab1.accesskey;"
-                                                  observes="otherActionsOpenIn"
                                                   oncommand="OpenMessageInNewTab(event);"/>
                                         <menuitem id="viewSourceMenuItem"
                                                   label="&viewSourceMenuItem1.label;"
                                                   accesskey="&viewSourceMenuItem1.accesskey;"
                                                   oncommand="ViewPageSource(gFolderDisplay.selectedMessageUris);" />
                                         <menuseparator id="otherActionsSeparator"/>
                                         <menuitem id="markAsReadMenuItem"
                                                   label="&markAsReadMenuItem1.label;"
--- a/mail/base/content/msgHdrView.js
+++ b/mail/base/content/msgHdrView.js
@@ -234,22 +234,23 @@ function OnLoadMsgHeaderPane() {
   // were coming from TB2, but we'll check that in the feature configurator).
   deckElement.usedCompactHeader = (deckElement.selectedIndex == 0);
 
   if (deckElement.selectedIndex < 0 ||
       deckElement.selectedIndex >= deckElement.childElementCount) {
     deckElement.selectedIndex = 0;
   }
 
-  // Only offer openInTab and openInNewWindow if this window supports tabs...
-  // (i.e. is not a standalone message window), since those actions are likely
-  // to be significantly less common in that case.
-  if (document.getElementById("otherActionsOpenIn")) {
-    let opensAreHidden = !document.getElementById("tabmail");
-    document.getElementById("otherActionsOpenIn").hidden = opensAreHidden;
+  // Only offer openInTab and openInNewWindow if this window supports tabs.
+  let opensAreHidden = !document.getElementById("tabmail");
+  for (let id of ["otherActionsOpenInNewWindow", "otherActionsOpenInNewTab"]) {
+    let menu = document.getElementById(id);
+    if (menu) {  // May not be available yet.
+      menu.hidden = opensAreHidden;
+    }
   }
 
   // Dispatch an event letting any listeners know that we have loaded
   // the message pane.
   var headerViewElement = document.getElementById("msgHeaderView");
   headerViewElement.dispatchEvent(new Event("messagepane-loaded",
     { bubbles: false, cancelable: true }));