Bug 784676 - Moving from a menuitem to splitmenu in AppMenu doesn't close old menuitem's menupopup. r=mkmelin, a=Standard8.
authorMike Conley <mconley@mozilla.com>
Fri, 14 Sep 2012 15:10:26 -0400
changeset 12113 1d31223635ef4aaaf1e0a0179bd4a395a902ce51
parent 12112 4787acf6b909f6c82b129b198a996039706ed6f4
child 12114 48886a8832e81ecc90422b5d32a0d093085578a5
push id695
push usermconley@mozilla.com
push dateFri, 14 Sep 2012 19:10:55 +0000
treeherdercomm-aurora@1d31223635ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, Standard8
bugs784676
Bug 784676 - Moving from a menuitem to splitmenu in AppMenu doesn't close old menuitem's menupopup. r=mkmelin, a=Standard8.
mail/base/content/mailWindowOverlay.js
mail/base/content/mailWindowOverlay.xul
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -3513,18 +3513,25 @@ function FeedSetContentView(val)
   }
   else if (contentBase && contentBase.headerValue) {
     document.getElementById("messagepane")
             .loadURI(contentBase.headerValue, null, null);
     gShowFeedSummaryToggle = false;
   }
 }
 
-function initAppMenuPopup()
+function initAppMenuPopup(aMenuPopup, aEvent)
 {
   file_init();
   view_init();
   InitGoMessagesMenu();
   menu_new_init();
   CommandUpdate_UndoRedo();
   InitAppEditMessagesMenu();
   document.commandDispatcher.updateCommands('create-menu-tasks');
+
+  // If the onpopupshowing event's target is on one of the splitmenu
+  // menuitem popups, stash that popup in aMenuPopup (the menupopup one
+  // level up) so that splitmenu knows which popup to close when it opens
+  // up it's popupmenu.
+  if (aEvent.target.parentNode.parentNode.parentNode.parentNode == aMenuPopup)
+    aMenuPopup._currentPopup = aEvent.target;
 }
--- a/mail/base/content/mailWindowOverlay.xul
+++ b/mail/base/content/mailWindowOverlay.xul
@@ -2025,17 +2025,17 @@
                    tooltiptext="&stopButton.tooltip;"
                    command="cmd_stop"/>
     <toolbarbutton id="button-appmenu"
                    type="menu"
                    class="toolbarbutton-1"
                    label="&appmenuButton.label;"
                    tooltiptext="&appmenuButton.tooltip;">
       <menupopup id="appmenu-popup"
-                 onpopupshowing="initAppMenuPopup();">
+                 onpopupshowing="initAppMenuPopup(this, event);">
         <hbox>
           <vbox id="appmenuPrimaryPane">
             <splitmenu id="appmenu_newMessage"
                        label="&appmenuNewMsgCmd.label;"
                        oncommand="MsgNewMessage(null);">
                 <menupopup id="appmenu_newMenupopup">
                   <menuitem id="newNewMsgCmd"
                             label="&newNewMsgCmd.label;"