Bug 784729 - 3pane easily busted if App Menu button is not present in mail-bar3. r=bwinton.
authorMike Conley <mconley@mozilla.com>
Thu, 23 Aug 2012 14:21:34 -0400
changeset 10950 2a012b86e886c2a235521254da4320f243e1ff77
parent 10949 115d3d4fa72577aac3c22e1aac3f0f9e169cf9d0
child 10951 185acd65afd686e1afe71219bc130cb7911856af
push id8212
push usermconley@mozilla.com
push dateThu, 23 Aug 2012 18:21:49 +0000
treeherdercomm-central@2a012b86e886 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwinton
bugs784729
Bug 784729 - 3pane easily busted if App Menu button is not present in mail-bar3. r=bwinton.
mail/base/content/mailWindowOverlay.js
mail/base/content/msgHdrViewOverlay.js
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -172,41 +172,59 @@ function view_init()
 
   let folderPaneMenuItem = document.getElementById("menu_showFolderPane");
   if (!folderPaneMenuItem.hidden) { // Hidden in the standalone msg window.
     folderPaneMenuItem.setAttribute("checked", gFolderDisplay.folderPaneVisible);
   }
 
   // Disable some menus if account manager is showing
   document.getElementById("viewSortMenu").disabled = accountCentralDisplayed;
-  document.getElementById("appmenu_viewSortMenu").disabled = accountCentralDisplayed;
+
+  let appmenuViewSort = document.getElementById("appmenu_viewSortMenu");
+  if (appmenuViewSort)
+    appmenuViewSort.disabled = accountCentralDisplayed;
+
   document.getElementById("viewMessageViewMenu").disabled = accountCentralDisplayed;
-  document.getElementById("appmenu_viewMessageViewMenu").disabled = accountCentralDisplayed;
+
+  let appmenuViewMessageView = document.getElementById("appmenu_viewMessageViewMenu");
+  if (appmenuViewMessageView)
+    appmenuViewMessageView.disabled = accountCentralDisplayed;
+
   document.getElementById("viewMessagesMenu").disabled = accountCentralDisplayed;
-  document.getElementById("appmenu_viewMessagesMenu").disabled = accountCentralDisplayed;
+
+  let appmenuViewMessagesMenu = document.getElementById("appmenu_viewMessagesMenu");
+  if (appmenuViewMessagesMenu)
+    appmenuViewMessagesMenu.disabled = accountCentralDisplayed;
 
   // Hide the views menu item if the user doesn't have the views toolbar button
   // visible.
   var viewsToolbarButton = document.getElementById("mailviews-container");
   document.getElementById('viewMessageViewMenu').hidden = !viewsToolbarButton;
 
   // Initialize the Message Body menuitem
   document.getElementById('viewBodyMenu').hidden = isFeed;
-  document.getElementById('appmenu_viewBodyMenu').hidden = isFeed;
+
+  let appmenuViewBodyMenu = document.getElementById('appmenu_viewBodyMenu');
+  if (appmenuViewBodyMenu)
+    appmenuViewBodyMenu.hidden = isFeed;
 
   // Initialize the Show Feed Summary menu
   var viewFeedSummary = document.getElementById('viewFeedSummary');
   let appmenuViewFeedSummary = document.getElementById('appmenu_viewFeedSummary');
   var winType = document.documentElement.getAttribute('windowtype');
   if (winType != "mail:3pane") {
     viewFeedSummary.hidden = !gShowFeedSummary;
-    appmenuViewFeedSummary.hidden = !gShowFeedSummary;
+
+    if (appmenuViewFeedSummary)
+      appmenuViewFeedSummary.hidden = !gShowFeedSummary;
   } else {
     viewFeedSummary.hidden = !isFeed;
-    appmenuViewFeedSummary.hidden = !isFeed;
+
+    if (appmenuViewFeedSummary)
+      appmenuViewFeedSummary.hidden = !isFeed;
   }
 
   var viewRssMenuItemIds = ["bodyFeedGlobalWebPage",
                             "bodyFeedGlobalSummary",
                             "bodyFeedPerFolderPref"];
   var checked = gPrefBranch.getIntPref("rss.show.summary");
   document.getElementById(viewRssMenuItemIds[checked])
           .setAttribute("checked", true);
--- a/mail/base/content/msgHdrViewOverlay.js
+++ b/mail/base/content/msgHdrViewOverlay.js
@@ -1112,17 +1112,23 @@ function ShowMessageHeaderPane()
 }
 
 function HideMessageHeaderPane()
 {
   document.getElementById("msgHeaderView").collapsed = true;
 
   // disable the File/Attachments menuitem
   document.getElementById("fileAttachmentMenu").setAttribute("disabled", "true");
-  document.getElementById("appmenu_fileAttachmentMenu").setAttribute("disabled", "true");
+
+  // If the App Menu is being used, disable the attachment menu in there as
+  // well.
+  let appMenuNode = document.getElementById("appmenu_fileAttachmentMenu");
+  if (appMenuNode)
+    appMenuNode.setAttribute("disabled", "true");
+
   // disable the attachment box
   document.getElementById("attachmentView").collapsed = true;
   document.getElementById("attachment-splitter").collapsed = true;
 
   ClearEditMessageBox();
 }
 
 /**