Bug 469498 - Combine messagePaneContext and threadPaneContext
authorIan Neal <iann_cvs@blueyonder.co.uk>
Thu, 29 Jan 2009 00:11:13 +0000
changeset 1785 f61570d094c528d85e8b6b4b7c9dfa1c1a25c4b0
parent 1784 84b1310158e31dd3d47de6d8b26c61a320b5e112
child 1786 174fa863d99c3d41eae53ce03ceab098e5e065bb
push id1439
push useriann_cvs@blueyonder.co.uk
push dateThu, 29 Jan 2009 00:12:01 +0000
treeherdercomm-central@f61570d094c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs469498
Bug 469498 - Combine messagePaneContext and threadPaneContext p=me r=mnyromyr sr=neil
mailnews/base/resources/content/mailContextMenus.js
mailnews/base/resources/content/mailWindow.js
mailnews/base/resources/content/mailWindowOverlay.xul
mailnews/base/resources/content/messageWindow.xul
mailnews/base/resources/content/messenger.xul
mailnews/base/resources/content/msgMail3PaneWindow.js
suite/common/mac/platformCommunicatorOverlay.xul
suite/common/nsContextMenu.js
suite/common/permissions/imageContextOverlay.xul
--- a/mailnews/base/resources/content/mailContextMenus.js
+++ b/mailnews/base/resources/content/mailContextMenus.js
@@ -19,16 +19,17 @@
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 2000
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Jan Varga <varga@ku.sk>
  *   Hakan Waara <hwaara@chello.se>
  *   Markus Hossner <markushossner@gmx.de>
+ *   Ian Neal <iann_bugzilla@blueyonder.co.uk>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -88,197 +89,137 @@ function RestoreSelectionWithoutContentL
     // Need to reset gRightMouseButtonDown to false here because
     // TreeOnMouseDown() is only called on a mousedown, not on a key down.
     // So resetting it here allows the loading of messages in the messagepane
     // when navigating via the keyboard or the toolbar buttons *after*
     // the context menu has been dismissed.
     gRightMouseButtonDown = false;
 }
 
-function threadPaneOnPopupHiding()
+function MailContextOnPopupHiding()
 {
-  RestoreSelectionWithoutContentLoad(GetThreadTree());
+  gContextMenu = null;
+  if (InThreadPane())
+    RestoreSelectionWithoutContentLoad(GetThreadTree());
 }
 
-function fillThreadPaneContextMenu()
+function InThreadPane()
 {
+  var node = document.popupNode;
+  while (node)
+  {
+    if (node.id == "threadTree")
+      return true;
+    node = node.parentNode;
+  }
+  return false;
+}
+
+function FillMailContextMenu(aTarget)
+{
+  var inThreadPane = InThreadPane();
+  gContextMenu = new nsContextMenu(aTarget);
   var numSelected = GetNumSelectedMessages();
+  var oneOrMore = (numSelected > 0);
+  var single = (numSelected == 1);
 
   var isNewsgroup = false;
   var selectedMessage = null;
 
   // Clear the global var used to keep track if a 'Delete Message' or 'Move
   // To' command has been triggered via the thread pane context menu.
   gThreadPaneDeleteOrMoveOccurred = false;
 
-  if(numSelected >= 0) {
+  if (numSelected >= 0)
+  {
     selectedMessage = GetFirstSelectedMessage();
     isNewsgroup = IsNewsMessage(selectedMessage);
   }
 
-  SetupNewMessageWindowMenuItem("threadPaneContext-openNewWindow", numSelected, false);
-  SetupEditAsNewMenuItem("threadPaneContext-editAsNew", numSelected, false);
-
-  ShowMenuItem("threadPaneContext-sep-open", (numSelected <= 1));
+  // Don't show mail items for links/images, just show related items.
+  var showMailItems = inThreadPane ||
+                      (!gContextMenu.onImage && !gContextMenu.onLink);
 
-  SetupReplyToSenderMenuItem("threadPaneContext-replySender", numSelected, false);
-  SetupReplyToNewsgroupMenuItem("threadPaneContext-replyNewsgroup", numSelected, isNewsgroup, false);
-  SetupReplyToSenderAndNewsgroupMenuItem("threadPaneContext-replySenderAndNewsgroup", numSelected, isNewsgroup, false);
-  SetupReplyAllMenuItem("threadPaneContext-replyAll", numSelected, false);
-  SetupForwardMenuItem("threadPaneContext-forward", numSelected, false);
-  SetupForwardAsAttachmentMenuItem("threadPaneContext-forwardAsAttachment", numSelected, false);
+  // Select-all and copy are only available in the message-pane
+  ShowMenuItem("context-selectall", single && !inThreadPane);
+  ShowMenuItem("context-copy", !inThreadPane);
 
-  ShowMenuItem("threadPaneContext-sep-reply", true);
+  ShowMenuItem("mailContext-openNewWindow", inThreadPane && single);
+  ShowMenuItem("mailContext-openNewTab", inThreadPane);
+  ShowMenuItem("mailContext-downloadflagged",
+               inThreadPane || (numSelected > 1));
+  ShowMenuItem("mailContext-downloadselected",
+               inThreadPane || (numSelected > 1));
 
-  SetupCopyMessageUrlMenuItem("threadPaneContext-copyMessageUrl", numSelected, isNewsgroup, numSelected != 1); 
-  SetupCopyMenuItem("threadPaneContext-copyMenu", numSelected, false);
-  SetupMoveMenuItem("threadPaneContext-moveMenu", numSelected, isNewsgroup, false);
-  EnableMenuItem("threadPaneContext-tags", (numSelected >= 1));
-  EnableMenuItem("threadPaneContext-mark", (numSelected >= 1));
-  SetupSaveAsMenuItem("threadPaneContext-saveAs", numSelected, false);
-  SetupPrintPreviewMenuItem("threadPaneContext-printpreview", numSelected, false);
-  SetupPrintMenuItem("threadPaneContext-print", numSelected, false);
-  SetupDeleteMenuItem("threadPaneContext-delete", numSelected, false);
-  SetupAddSenderToABMenuItem("threadPaneContext-addSenderToAddressBook", numSelected, false);
-  SetupAddAllToABMenuItem("threadPaneContext-addAllToAddressBook", numSelected, false);
+  ShowMenuItem("mailContext-editAsNew", showMailItems && oneOrMore);
+  ShowMenuItem("mailContext-replySender", showMailItems && single);
+  ShowMenuItem("mailContext-replyNewsgroup",
+               showMailItems && single && isNewsgroup);
+  ShowMenuItem("mailContext-replySenderAndNewsgroup",
+               showMailItems && single && isNewsgroup);
+  ShowMenuItem("mailContext-replyAll", showMailItems && single);
+  ShowMenuItem("mailContext-forward", showMailItems && single);
+  ShowMenuItem("mailContext-forwardAsAttachment",
+               showMailItems && (numSelected > 1));
+  ShowMenuItem("mailContext-copyMessageUrl",
+               showMailItems && single && isNewsgroup);
 
-  ShowMenuItem("threadPaneContext-sep-edit", (numSelected <= 1));
-
-  return(true);
-}
+  // Set up the move menu. We can't move from newsgroups.
+  // Disable move if we can't delete message(s) from this folder.
+  var msgFolder = GetLoadedMsgFolder();
+  ShowMenuItem("mailContext-moveMenu",
+               showMailItems && oneOrMore && !isNewsgroup);
+  EnableMenuItem("mailContext-moveMenu",
+                 oneOrMore && msgFolder && msgFolder.canDeleteMessages);
 
-function SetupNewMessageWindowMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
-  EnableMenuItem(menuID, (numSelected == 1));
-}
+  // Copy is available as long as something is selected.
+  ShowMenuItem("mailContext-copyMenu", showMailItems && oneOrMore);
+  ShowMenuItem("mailContext-tags", showMailItems && oneOrMore);
+  ShowMenuItem("mailContext-mark", showMailItems && oneOrMore);
+  ShowMenuItem("mailContext-saveAs", showMailItems && single);
+  ShowMenuItem("mailContext-printpreview", showMailItems && single);
 
-function SetupEditAsNewMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1)&& !forceHide);
-  EnableMenuItem(menuID, (numSelected == 1));
-}
-
-function SetupReplyToSenderMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1)&& !forceHide);
-  EnableMenuItem(menuID, (numSelected == 1));
-}
+  ShowMenuItem("mailContext-print", showMailItems);
+  EnableMenuItem("mailContext-print", oneOrMore);
+  ShowMenuItem("mailContext-delete", showMailItems);
+  EnableMenuItem("mailContext-delete", oneOrMore);
+  // This function is needed for the case where a folder is just loaded
+  // (while there isn't a message loaded in the message pane), a right-click
+  // is done in the thread pane.  This function will disable enable the
+  // 'Delete Message' menu item.
+  goUpdateCommand('cmd_delete');
 
-function SetupReplyToNewsgroupMenuItem(menuID, numSelected, isNewsgroup, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1) && isNewsgroup && !forceHide);
-  EnableMenuItem(menuID,  (numSelected == 1));
-}
+  ShowMenuItem("context-addemail", gContextMenu.onMailtoLink);
+  ShowMenuItem("context-composeemailto", gContextMenu.onMailtoLink);
+  ShowMenuItem("context-createfilterfrom", gContextMenu.onMailtoLink);
 
-function SetupReplyToSenderAndNewsgroupMenuItem(menuID, numSelected, isNewsgroup, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1) && isNewsgroup && !forceHide);
-  EnableMenuItem(menuID,  (numSelected == 1));
-}
+  // Figure out separators.
+  ShowSeparator("mailContext-sep-open");
+  ShowSeparator("mailContext-sep-edit");
+  ShowSeparator("mailContext-sep-link");
+  ShowSeparator("mailContext-sep-image");
+  ShowSeparator("mailContext-sep-copy");
+  ShowSeparator("mailContext-sep-print");
+  ShowSeparator("mailContext-sep-tags");
+  ShowSeparator("mailContext-sep-mark");
+  ShowSeparator("mailContext-sep-move");
 
-function SetupReplyAllMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
-  EnableMenuItem(menuID, (numSelected == 1));
-}
+  // If we are on a link, go ahead and hide this separator.
+  if (gContextMenu.onLink)
+    ShowMenuItem("mailContext-sep-copy", false);
 
-function SetupForwardMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID,  (numSelected <= 1) && !forceHide);
-  EnableMenuItem(menuID, (numSelected > 0));
+  return true;
 }
 
-function SetupForwardAsAttachmentMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID,  (numSelected > 1) && !forceHide);
-  EnableMenuItem(menuID, (numSelected > 1));
-}
-
-function SetupMoveMenuItem(menuID, numSelected, isNewsgroup, forceHide)
-{
-  ShowMenuItem(menuID, !isNewsgroup && !forceHide);
-
-  var msgFolder = GetLoadedMsgFolder();
-  // disable move if we can't delete message(s) from this folder
-  var enableMenuItem = (numSelected > 0) && msgFolder && msgFolder.canDeleteMessages;
-  EnableMenuItem(menuID, enableMenuItem);
-}
-
-function SetupCopyMessageUrlMenuItem(menuID, numSelected, isNewsgroup, forceHide)
-{
-  ShowMenuItem(menuID, isNewsgroup && !forceHide);
-  EnableMenuItem(menuID, (numSelected > 0));
-}
-
-function SetupCopyMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, !forceHide);
-  EnableMenuItem(menuID, (numSelected > 0));
-}
-
-function SetupTagsMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
-  EnableMenuItem(menuID, (numSelected == 1));
-}
-
-function SetupMarkMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
-  EnableMenuItem(menuID, (numSelected == 1));
-}
-
-function SetupSaveAsMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
-  EnableMenuItem(menuID, (numSelected == 1));
-}
-
-function SetupPrintPreviewMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
-  EnableMenuItem(menuID, (numSelected == 1));
-}
-
-function SetupPrintMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, !forceHide);
-  EnableMenuItem(menuID, (numSelected > 0));
-}
-
-function SetupAddSenderToABMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
-  EnableMenuItem(menuID, false);
-}
-
-function SetupAddAllToABMenuItem(menuID, numSelected, forceHide)
-{
-  ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
-  EnableMenuItem(menuID, false);
-}
-
-function SetupDeleteMenuItem(menuID, numSelected, forceHide)
-{
-  // This function is needed for the case where a folder is just loaded (while
-  // there isn't a message loaded in the message pane), a right-click is done
-  // in the thread pane.  This function will disable enable the 'Delete
-  // Message' menu item.
-  ShowMenuItem(menuID, !forceHide);
-  EnableMenuItem(menuID, (numSelected > 0));
-  goUpdateCommand('cmd_delete');
-}
-
-function folderPaneOnPopupHiding()
+function FolderPaneOnPopupHiding()
 {
   RestoreSelectionWithoutContentLoad(GetFolderTree());
 }
 
-function fillFolderPaneContextMenu()
+function FillFolderPaneContextMenu()
 {
   if (IsFakeAccount())
     return false;
 
   var folderTree = GetFolderTree();
   var startIndex = {};
   var endIndex = {};
   folderTree.view.selection.getRangeAt(0, startIndex, endIndex);
@@ -334,19 +275,18 @@ function fillFolderPaneContextMenu()
 
   ShowMenuItem("folderPaneContext-emptyTrash", (numSelected <= 1) && (specialFolder == 'Trash'));
   EnableMenuItem("folderPaneContext-emptyTrash", true);
   ShowMenuItem("folderPaneContext-emptyJunk", (numSelected <= 1) && (specialFolder == 'Junk'));
   EnableMenuItem("folderPaneContext-emptyJunk", true);
 
   var showSendUnsentMessages = (numSelected <= 1) && (specialFolder == 'Unsent Messages');
   ShowMenuItem("folderPaneContext-sendUnsentMessages", showSendUnsentMessages);
-  if (showSendUnsentMessages) {
+  if (showSendUnsentMessages)
     EnableMenuItem("folderPaneContext-sendUnsentMessages", IsSendUnsentMsgsEnabled(folderResource));
-  }
 
   ShowMenuItem("folderPaneContext-sep-edit", (numSelected <= 1));
 
   SetupNewMenuItem(folderResource, numSelected, isServer, serverType, specialFolder);
 
   ShowMenuItem("folderPaneContext-subscribe", (numSelected <= 1) && canSubscribeToFolder && !isVirtualFolder);
   EnableMenuItem("folderPaneContext-subscribe", true);
 
@@ -475,99 +415,42 @@ function SetMenuItemLabel(id, label)
 
 function SetMenuItemAccessKey(id, accessKey)
 {
   var item = document.getElementById(id);
   if(item)
     item.setAttribute('accesskey', accessKey);
 }
 
-function fillMessagePaneContextMenu()
+function SiblingHidden(aSibling, aNext)
 {
-  var message = GetLoadedMessage();
-  var numSelected = (message) ? 1 : 0;
-
-  var isNewsgroup = false;
-
-  if (numSelected == 1)
-    isNewsgroup = IsNewsMessage(message);
-
-  // don't show mail items for links/images, just show related items.
-  var hideMailItems = gContextMenu.onImage || gContextMenu.onLink;
-
-  SetupEditAsNewMenuItem("messagePaneContext-editAsNew", numSelected, (numSelected == 0 || hideMailItems));
-  SetupReplyToSenderMenuItem("messagePaneContext-replySender", numSelected, (numSelected == 0 || hideMailItems));
-  SetupReplyToNewsgroupMenuItem("messagePaneContext-replyNewsgroup", numSelected, isNewsgroup, (numSelected == 0 || hideMailItems));
-  SetupReplyAllMenuItem("messagePaneContext-replyAll" , numSelected, (numSelected == 0 || hideMailItems));
-  SetupForwardMenuItem("messagePaneContext-forward", numSelected, (numSelected == 0 || hideMailItems));
-  SetupCopyMessageUrlMenuItem("messagePaneContext-copyMessageUrl", numSelected, isNewsgroup, (numSelected == 0 || hideMailItems)); 
-  SetupCopyMenuItem("messagePaneContext-copyMenu", numSelected, (numSelected == 0 || hideMailItems));
-  SetupMoveMenuItem("messagePaneContext-moveMenu", numSelected, isNewsgroup, (numSelected == 0 || hideMailItems));
-  SetupTagsMenuItem("messagePaneContext-tags", numSelected, (numSelected == 0 || hideMailItems));
-  SetupMarkMenuItem("messagePaneContext-mark", numSelected, (numSelected == 0 || hideMailItems));
-  SetupSaveAsMenuItem("messagePaneContext-saveAs", numSelected, (numSelected == 0 || hideMailItems));
-  SetupPrintPreviewMenuItem("messagePaneContext-printpreview", numSelected, (numSelected == 0 || hideMailItems));
-  SetupPrintMenuItem("messagePaneContext-print", numSelected, (numSelected == 0 || hideMailItems));
-  if (numSelected == 0 || hideMailItems)
-    ShowMenuItem("messagePaneContext-delete", false)
-  else {
-    goUpdateCommand('cmd_delete');
-    ShowMenuItem("messagePaneContext-delete", true)
+  var siblingID;
+  while (aSibling)
+  {
+    siblingID = aSibling.id;
+    // For some reason, context-blockimage and context-unblockimage are not
+    // hidden on the very first time the context menu is invoked. They are only
+    // hidden on subsequent triggers of the context menu. Since we're not
+    // using these two menuitems in mailnews, we can ignore them if encountered.
+    if (!aSibling.hidden && (siblingID != "context-blockimage") &&
+        (siblingID != "context-unblockimage"))
+      return aSibling.localName == "menuseparator";
+    aSibling = aNext ? aSibling.nextSibling : aSibling.previousSibling;
   }
-  SetupAddSenderToABMenuItem("messagePaneContext-addSenderToAddressBook", numSelected, (numSelected == 0 || hideMailItems));
-  SetupAddAllToABMenuItem("messagePaneContext-addAllToAddressBook", numSelected, (numSelected == 0 || hideMailItems));
-
-  ShowMenuItem("context-addemail", gContextMenu.onMailtoLink);
-  ShowMenuItem("context-composeemailto", gContextMenu.onMailtoLink);
-  ShowMenuItem("context-createfilterfrom", gContextMenu.onMailtoLink);
-
-  //Figure out separators
-  ShowMenuItem("messagePaneContext-sep-open", ShowSeparator("messagePaneContext-sep-open"));
-  ShowMenuItem("messagePaneContext-sep-reply", ShowSeparator("messagePaneContext-sep-reply"));
-  ShowMenuItem("messagePaneContext-sep-edit", ShowSeparator("messagePaneContext-sep-edit"));
-  ShowMenuItem("messagePaneContext-sep-link", ShowSeparator("messagePaneContext-sep-link"));
-  ShowMenuItem("messagePaneContext-sep-image", ShowSeparator("messagePaneContext-sep-image"));
-  ShowMenuItem("messagePaneContext-sep-copy", ShowSeparator("messagePaneContext-sep-copy"));
-  ShowMenuItem("messagePaneContext-sep-tags", ShowSeparator("messagePaneContext-sep-tags"));
-  ShowMenuItem("messagePaneContext-sep-mark", ShowSeparator("messagePaneContext-sep-mark"));
-  
-  // if we are on a link, go ahead and hide this separator
-  if (gContextMenu.onLink)
-    ShowMenuItem("messagePaneContext-sep-edit", false);
+  return true;
 }
 
 function ShowSeparator(aSeparatorID)
 {
   var separator = document.getElementById(aSeparatorID);
-  var sibling = separator.previousSibling;
-  var siblingID;
-  var siblingNextHiddenAttrib = separator.nextSibling.getAttribute("hidden");
-
-  while (sibling && sibling.localName != "menuseparator") {
-    siblingID = sibling.getAttribute("id");
-    // for some reason, context-blockimage and context-unblockimage is not
-    // hidden on the very first time the context menu is invoked.  It's only
-    // hidden on subsequent triggers of the context menu.  Since we're not
-    // using these two menuitems in mailnews, we can ignore it if encountered.
-    if ((sibling.getAttribute("hidden") != "true") && 
-        (siblingNextHiddenAttrib != "true") &&
-        (siblingID != "context-blockimage") &&
-        (siblingID != "context-unblockimage"))
-      return true;
-    sibling = sibling.previousSibling;
-  }
-  return false;
-}
-
-function IsMenuItemShowing(menuID)
-{
-  var item = document.getElementById(menuID);
-  if (item)
-    return item.hidden != "true";
-  return false;
+  // Check to see if there are visible siblings before the next and
+  // previous separators.
+  var hidden = SiblingHidden(separator.nextSibling, true) ||
+               SiblingHidden(separator.previousSibling, false);
+  ShowMenuItem(aSeparatorID, !hidden);
 }
 
 // message pane context menu helper methods
 function AddNodeToAddressBook(emailAddressNode)
 {
   if (emailAddressNode)
     AddEmailToAddressBook(emailAddressNode.getAttribute("emailAddress"),
                           emailAddressNode.getAttribute("displayName"));
@@ -820,30 +703,28 @@ function CreateFilter(emailAddressNode)
 function CreateFilterFromMail(emailAddress)
 {
   if (emailAddress)
     top.MsgFilters(emailAddress, GetFirstSelectedMsgFolder());
 }
 
 function CopyMessageUrl()
 {
-  try {
+  try
+  {
     var hdr = gDBView.hdrForFirstSelectedMessage;
     var server = hdr.folder.server;
 
     var url = (server.socketType == Components.interfaces.nsIMsgIncomingServer.useSSL) ?
               "snews://" : "news://";
-    url += server.hostName;
-    url += ":";
-    url += server.port;
-    url += "/";
-    url += hdr.messageId;
+    url += server.hostName + ":" + server.port + "/" + hdr.messageId;
     CopyString(url);
   }
-  catch (ex) {
+  catch (ex)
+  {
     dump("ex="+ex+"\n");
   }
 }
 
 function CopyString(aString)
 {
   Components.classes["@mozilla.org/widget/clipboardhelper;1"]
             .getService(Components.interfaces.nsIClipboardHelper)
--- a/mailnews/base/resources/content/mailWindow.js
+++ b/mailnews/base/resources/content/mailWindow.js
@@ -331,32 +331,24 @@ function messagePaneOnClick(event)
   openAsExternal(href);
   return true;
 }
 
 function AddDataSources()
 {
   accountManagerDataSource = accountManagerDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
   folderDataSource = folderDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
-  //to move menu item
+
   SetupMoveCopyMenus('moveMenu', accountManagerDataSource, folderDataSource);
-
-  //to copy menu item
   SetupMoveCopyMenus('copyMenu', accountManagerDataSource, folderDataSource);
-
-
-  //To FileButton menu
   SetupMoveCopyMenus('button-file', accountManagerDataSource, folderDataSource);
-
-  //To move and copy menus in message pane context
-  SetupMoveCopyMenus("messagePaneContext-copyMenu", accountManagerDataSource, folderDataSource);
-  SetupMoveCopyMenus("messagePaneContext-moveMenu", accountManagerDataSource, folderDataSource);
+  SetupMoveCopyMenus('mailContext-copyMenu', accountManagerDataSource, folderDataSource);
+  SetupMoveCopyMenus('mailContext-moveMenu', accountManagerDataSource, folderDataSource);
 
   //Add statusFeedback
-
   var msgDS = folderDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
   msgDS.window = msgWindow;
 
   msgDS = accountManagerDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
   msgDS.window = msgWindow;
 
 }
 
--- a/mailnews/base/resources/content/mailWindowOverlay.xul
+++ b/mailnews/base/resources/content/mailWindowOverlay.xul
@@ -18,17 +18,17 @@
 
  The Initial Developer of the Original Code is
  Netscape Communications Corporation.
  Portions created by the Initial Developer are Copyright (C) 1998-1999
  the Initial Developer. All Rights Reserved.
 
  Contributor(s):
   Neil Rashbrook <neil@parkwaycc.co.uk>
-  Ian Neal <iann_bugzilla@arlen.demon.co.uk>
+  Ian Neal <iann_bugzilla@blueyonder.co.uk>
   Karsten Düsterloh <mnyromyr@tprac.de>
 
  Alternatively, the contents of this file may be used under the terms of
  either of the GNU General Public License Version 2 or later (the "GPL"),
  or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  in which case the provisions of the GPL or the LGPL are applicable instead
  of those above. If you wish to allow use of your version of this file only
  under the terms of either the GPL or the LGPL, and not to allow others to
@@ -413,63 +413,237 @@
   <key id="key_tag7" key="&tagCmd7.key;" oncommand="ToggleMessageTagKey(7);"/>
   <key id="key_tag8" key="&tagCmd8.key;" oncommand="ToggleMessageTagKey(8);"/>
   <key id="key_tag9" key="&tagCmd9.key;" oncommand="ToggleMessageTagKey(9);"/>
 
   <key id="key_searchMail" key="&searchMailCmd.key;" oncommand="goDoCommand('cmd_search')" modifiers="accel, shift"/>
 
 </keyset>
 
-  <popup id="threadPaneContext" onpopupshowing="return fillThreadPaneContextMenu();"
-    onpopuphiding="if (event.target == this) threadPaneOnPopupHiding();">
-    <menuitem id="threadPaneContext-openNewWindow"
-        label="&contextOpenNewWindow.label;"
-        accesskey="&contextOpenNewWindow.accesskey;"
-        oncommand="MsgOpenNewWindowForMessage();"/>
-    <menuseparator id="threadPaneContext-sep-open"/>
-    <menuitem id="threadPaneContext-replySender"
-        label="&contextReplySender.label;"
-        accesskey="&contextReplySender.accesskey;"
-        oncommand="MsgReplySender(event);"/>
-    <menuitem id="threadPaneContext-replyNewsgroup"
-        label="&contextReplyNewsgroup.label;"
-        accesskey="&contextReplyNewsgroup.accesskey;"
-        oncommand="MsgReplyGroup(event);"/>
-    <menuitem id="threadPaneContext-replySenderAndNewsgroup"
-        label="&contextReplySenderAndNewsgroup.label;"
-        accesskey="&contextReplySenderAndNewsgroup.accesskey;"
-        oncommand="MsgReplyToSenderAndGroup(event);"/>
-    <menuitem id="threadPaneContext-replyAll"
-        label="&contextReplyAll.label;"
-        accesskey="&contextReplyAll.accesskey;"
-        oncommand="MsgReplyToAllRecipients(event);"/>
-    <menuitem id="threadPaneContext-forward"
-        label="&contextForward.label;"
-        accesskey="&contextForward.accesskey;"
-        oncommand="MsgForwardMessage(event);"/>
-    <menuitem id="threadPaneContext-forwardAsAttachment"
-        label="&contextForwardAsAttachment.label;"
-        accesskey="&contextForwardAsAttachment.accesskey;"
-        oncommand="MsgForwardAsAttachment(event);"/>
-    <menuitem id="threadPaneContext-editAsNew"
-        label="&contextEditAsNew.label;"
-        accesskey="&contextEditAsNew.accesskey;"
-        oncommand="MsgEditMessageAsNew();"/>
-    <menuseparator id="threadPaneContext-sep-reply"/>
-    <menuitem id="threadPaneContext-copyMessageUrl"
-        label="&copyMessageLocation.label;"
-        accesskey="&copyMessageLocation.accesskey;"
-        oncommand="CopyMessageUrl()"/>
-    <menu id="threadPaneContext-moveMenu"
-        label="&contextMoveMsgMenu.label;"
-        accesskey="&contextMoveMsgMenu.accesskey;"
-        sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-        sortDirection="ascending"
-        datasources="rdf:null">
-      <menupopup>
+  <popup id="folderPaneContext"
+         onpopupshowing="return FillFolderPaneContextMenu();"
+         onpopuphiding="if (event.target == this) FolderPaneOnPopupHiding();">
+
+    <menuitem id="folderPaneContext-getMessages"
+              label="&folderContextGetMessages.label;"
+              accesskey="&folderContextGetMessages.accesskey;"
+              oncommand="MsgGetMessage();"/>
+
+    <menuitem id="folderPaneContext-openNewWindow"
+              label="&folderContextOpenNewWindow.label;"
+              accesskey="&folderContextOpenNewWindow.accesskey;"
+              oncommand="MsgOpenNewWindowForFolder(null,-1);"/>
+
+    <menuitem id="folderPaneContext-searchMessages"
+              label="&folderContextSearchMessages.label;"
+              accesskey="&folderContextSearchMessages.accesskey;"
+              command="cmd_search"/>
+
+    <menuitem id="folderPaneContext-subscribe"
+        label="&folderContextSubscribe.label;"
+        accesskey="&folderContextSubscribe.accesskey;"
+        oncommand="MsgSubscribe();"/>
+    <menuitem id="folderPaneContext-newsUnsubscribe"
+        label="&folderContextUnsubscribe.label;"
+        accesskey="&folderContextUnsubscribe.accesskey;"
+        oncommand="MsgUnsubscribe();"/>
+
+    <menuseparator id="folderPaneContext-sep1"/>
+
+    <menuitem id="folderPaneContext-new"
+        label="&folderContextNew.label;"
+        accesskey="&folderContextNew.accesskey;"
+        oncommand="MsgNewFolder(NewFolder);"/>
+    <menuitem id="folderPaneContext-remove"
+              label="&folderContextRemove.label;"
+              accesskey="&folderContextRemove.accesskey;"
+              oncommand="MsgDeleteFolder();"/>
+    <menuitem id="folderPaneContext-rename"
+        label="&folderContextRename.label;"
+        accesskey="&folderContextRename.accesskey;"
+        oncommand="MsgRenameFolder();"/>
+
+    <menuitem id="folderPaneContext-compact"
+        label="&folderContextCompact.label;"
+        accesskey="&folderContextCompact.accesskey;"
+        oncommand="MsgCompactFolder(false);"/>
+    <menuitem id="folderPaneContext-markMailFolderAllRead"
+              label="&folderContextMarkMailFolderRead.label;"
+              accesskey="&folderContextMarkMailFolderRead.accesskey;"
+              oncommand="MsgMarkAllRead();"/>
+    <menuitem id="folderPaneContext-markNewsgroupAllRead"
+              label="&folderContextMarkNewsgroupRead.label;"
+              accesskey="&folderContextMarkNewsgroupRead.accesskey;"
+              oncommand="MsgMarkAllRead();"/>
+    <menuitem id="folderPaneContext-emptyTrash"
+        label="&folderContextEmptyTrash.label;"
+        accesskey="&folderContextEmptyTrash.accesskey;"
+        oncommand="MsgEmptyTrash();"/>
+    <menuitem id="folderPaneContext-emptyJunk"
+        label="&folderContextEmptyJunk.label;"
+        accesskey="&folderContextEmptyJunk.accesskey;"
+        oncommand="deleteAllInFolder('emptyJunk');"/>
+    <menuitem id="folderPaneContext-sendUnsentMessages"
+        label="&folderContextSendUnsentMessages.label;"
+        accesskey="&folderContextSendUnsentMessages.accesskey;"
+        oncommand="goDoCommand('cmd_sendUnsentMsgs')"/>
+
+    <menuseparator id="folderPaneContext-sep-edit"/>
+
+    <menuitem id="folderPaneContext-properties"
+        label="&folderContextProperties.label;"
+        accesskey="&folderContextProperties.accesskey;"
+        oncommand="MsgFolderProperties();"/>
+    <menuitem id="folderPaneContext-settings"
+              label="&folderContextSettings.label;"
+              accesskey="&folderContextSettings.accesskey;"
+              oncommand="MsgFolderProperties();"/>
+  </popup>
+
+  <popup id="mailContext"
+         onpopupshowing="return event.target != this ||
+                                FillMailContextMenu(this);"
+         onpopuphiding="if (event.target == this) MailContextOnPopupHiding();">
+    <menuitem id="context-openlink"
+              label="&openLinkCmd.label;"
+              accesskey="&openLinkCmd.accesskey;"
+              oncommand="gContextMenu.openLink();"/>
+    <menuitem id="context-openlinkintab"
+              label="&openLinkCmdInTab.label;"
+              accesskey="&openLinkCmdInTab.accesskey;"
+              oncommand="gContextMenu.openLinkInTab(event.shiftKey);"/>
+    <menuseparator id="mailContext-sep-link"/>
+    <menuitem id="context-selectall"
+              label="&selectAllCmd.label;"
+              accesskey="&selectAllCmd.accesskey;"
+              command="cmd_selectAll"/>
+    <menuitem id="context-copy"
+              label="&copyCmd.label;"
+              accesskey="&copyCmd.accesskey;"
+              command="cmd_copy"/>
+    <menuitem id="mailContext-openNewWindow"
+              label="&contextOpenNewWindow.label;"
+              accesskey="&contextOpenNewWindow.accesskey;"
+              oncommand="MsgOpenNewWindowForMessage();"/>
+    <menuseparator id="mailContext-sep-open"/>
+    <menuitem id="mailContext-replySender"
+              label="&contextReplySender.label;"
+              accesskey="&contextReplySender.accesskey;"
+              oncommand="MsgReplySender(event);"/>
+    <menuitem id="mailContext-replyNewsgroup"
+              label="&contextReplyNewsgroup.label;"
+              accesskey="&contextReplyNewsgroup.accesskey;"
+              oncommand="MsgReplyGroup(event);"/>
+    <menuitem id="mailContext-replySenderAndNewsgroup"
+              label="&contextReplySenderAndNewsgroup.label;"
+              accesskey="&contextReplySenderAndNewsgroup.accesskey;"
+              oncommand="MsgReplyToSenderAndGroup(event);"/>
+    <menuitem id="mailContext-replyAll"
+              label="&contextReplyAll.label;"
+              accesskey="&contextReplyAll.accesskey;"
+              oncommand="MsgReplyToAllRecipients(event);"/>
+    <menuitem id="mailContext-forward"
+              label="&contextForward.label;"
+              accesskey="&contextForward.accesskey;"
+              oncommand="MsgForwardMessage(event);"/>
+    <menuitem id="mailContext-forwardAsAttachment"
+              label="&contextForwardAsAttachment.label;"
+              accesskey="&contextForwardAsAttachment.accesskey;"
+              oncommand="MsgForwardAsAttachment(event);"/>
+    <menuitem id="mailContext-editAsNew"
+              label="&contextEditAsNew.label;"
+              accesskey="&contextEditAsNew.accesskey;"
+              oncommand="MsgEditMessageAsNew();"/>
+    <menuseparator id="mailContext-sep-tags"/>
+    <menu id="mailContext-tags"
+          label="&tagMenu.label;"
+          accesskey="&tagMenu.accesskey;">
+      <menupopup id="mailContext-tagpopup"
+                 onpopupshowing="InitMessageTags(this)">
+        <menuitem id="mailContext-tagRemoveAll"
+                  oncommand="RemoveAllMessageTags();"/>
+        <menuseparator/>
+        <menuseparator/>
+        <menuitem id="mailContext-tagCustomize"
+                  label="&tagCustomize.label;"
+                  accesskey="&tagCustomize.accesskey;"
+                  oncommand="goPreferences('tags_pane');"/>
+      </menupopup>
+    </menu>
+    <menu id="mailContext-mark"
+          label="&markMenu.label;"
+          accesskey="&markMenu.accesskey;">
+      <menupopup onpopupshowing="InitMessageMark()">
+        <menuitem id="mailContext-markRead"
+                  type="checkbox"
+                  label="&markAsReadCmd.label;"
+                  accesskey="&markAsReadCmd.accesskey;"
+                  command="cmd_markAsRead"/>
+        <menuitem id="mailContext-markThreadAsRead"
+                  label="&markThreadAsReadCmd.label;"
+                  accesskey="&markThreadAsReadCmd.accesskey;"
+                  command="cmd_markThreadAsRead"/>
+        <menuitem id="mailContext-markReadByDate"
+                  label="&markReadByDateCmd.label;"
+                  accesskey="&markReadByDateCmd.accesskey;"
+                  command="cmd_markReadByDate"/>
+        <menuitem id="mailContext-markAllRead"
+                  label="&markAllReadCmd.label;"
+                  accesskey="&markAllReadCmd.accesskey;"
+                  command="cmd_markAllRead"/>
+        <menuseparator/>
+        <menuitem id="mailContext-markFlagged"
+                  type="checkbox"
+                  label="&markFlaggedCmd.label;"
+                  accesskey="&markFlaggedCmd.accesskey;"
+                  command="cmd_markAsFlagged"/>
+        <menuseparator/>
+        <menuitem id="mailContext-markAsJunk"
+                  label="&markAsJunkCmd.label;"
+                  accesskey="&markAsJunkCmd.accesskey;"
+                  command="cmd_markAsJunk"/>
+        <menuitem id="mailContext-markAsNotJunk"
+                  label="&markAsNotJunkCmd.label;"
+                  accesskey="&markAsNotJunkCmd.accesskey;"
+                  command="cmd_markAsNotJunk"/>
+        <menuitem id="mailContext-recalculateJunkScore"
+                  label="&recalculateJunkScoreCmd.label;"
+                  accesskey="&recalculateJunkScoreCmd.accesskey;"
+                  command="cmd_recalculateJunkScore"/>
+        <menuitem id="mailContext-markAsShowRemote"
+                  label="&markAsShowRemoteCmd.label;"
+                  accesskey="&markAsShowRemoteCmd.accesskey;"
+                  command="cmd_markAsShowRemote"/>
+        <menuitem id="mailContext-markAsNotPhish"
+                  label="&markAsNotPhishCmd.label;"
+                  accesskey="&markAsNotPhishCmd.accesskey;"
+                  command="cmd_markAsNotPhish"/>
+      </menupopup>
+    </menu>
+    <menuseparator id="mailContext-sep-mark"/>
+    <menuitem id="mailContext-downloadflagged"
+              label="&downloadFlaggedCmd.label;"
+              accesskey="&downloadFlaggedCmd.accesskey;"
+              command="cmd_downloadFlagged"/>
+    <menuitem id="mailContext-downloadselected"
+              label="&downloadSelectedCmd.label;"
+              accesskey="&downloadSelectedCmd.accesskey;"
+              command="cmd_downloadSelected"/>
+    <menuseparator id="mailContext-sep-move"/>
+    <menuitem id="mailContext-copyMessageUrl"
+              label="&copyMessageLocation.label;"
+              accesskey="&copyMessageLocation.accesskey;"
+              oncommand="CopyMessageUrl()"/>
+    <menu id="mailContext-moveMenu"
+          label="&contextMoveMsgMenu.label;"
+          accesskey="&contextMoveMsgMenu.accesskey;"
+          sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
+          sortDirection="ascending"
+          datasources="rdf:null">
+      <menupopup id="mailContext-fileHereMenu">
         <menu label="&contextMoveCopyMsgRecentMenu.label;"
               accesskey="&contextMoveCopyMsgRecentMenu.accesskey;"
               sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
               sortDirection="ascending"
               datasources="rdf:mailnewsrecentfolders"
               ref="mailnewsrecentfolders:/">
           <menupopup/>
           <template>
@@ -545,23 +719,23 @@
               BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
               IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
               IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
               ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
           </menupopup>
         </rule>
       </template>
     </menu>
-    <menu id="threadPaneContext-copyMenu"
-      label="&contextCopyMsgMenu.label;"
-      accesskey="&contextCopyMsgMenu.accesskey;"
-      sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-      sortDirection="ascending"
-      datasources="rdf:null">
-      <menupopup>
+    <menu id="mailContext-copyMenu"
+          label="&contextCopyMsgMenu.label;"
+          accesskey="&contextCopyMsgMenu.accesskey;"
+          sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
+          sortDirection="ascending"
+          datasources="rdf:null">
+      <menupopup id="mailContext-copyHereMenu">
         <menu label="&contextMoveCopyMsgRecentMenu.label;"
               accesskey="&contextMoveCopyMsgRecentMenu.accesskey;"
               sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
               sortDirection="ascending"
               datasources="rdf:mailnewsrecentfolders"
               ref="mailnewsrecentfolders:/">
           <menupopup/>
           <template>
@@ -638,510 +812,77 @@
               BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
               IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
               IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
               ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
           </menupopup>
         </rule>
       </template>
     </menu>
-    <menu id="threadPaneContext-tags" label="&tagMenu.label;" accesskey="&tagMenu.accesskey;">
-      <menupopup id="threadPaneContext-tagpopup" onpopupshowing="InitMessageTags(this)">
-        <menuitem id="threadPaneContext-tagRemoveAll" oncommand="RemoveAllMessageTags();"/>
-        <menuseparator/>
-        <menuseparator/>
-        <menuitem id="threadPaneContext-tagCustomize"
-                  label="&tagCustomize.label;"
-                  accesskey="&tagCustomize.accesskey;"
-                  oncommand="goPreferences('tags_pane');"/>
-      </menupopup>
-    </menu>
-    <menu id="threadPaneContext-mark" label="&markMenu.label;" accesskey="&markMenu.accesskey;">
-      <menupopup onpopupshowing="InitMessageMark()">
-        <menuitem id="threadPaneContext-markRead"
-                  type="checkbox"
-                  label="&markAsReadCmd.label;"
-                  accesskey="&markAsReadCmd.accesskey;"
-                  command="cmd_markAsRead"/>
-        <menuitem label="&markThreadAsReadCmd.label;"
-                  accesskey="&markThreadAsReadCmd.accesskey;"
-                  command="cmd_markThreadAsRead"/>
-        <menuitem label="&markReadByDateCmd.label;"
-                  accesskey="&markReadByDateCmd.accesskey;"
-                  command="cmd_markReadByDate"/>
-        <menuitem label="&markAllReadCmd.label;"
-                  accesskey="&markAllReadCmd.accesskey;"
-                  command="cmd_markAllRead"/>
-        <menuseparator/>
-        <menuitem id="threadPaneContext-markFlagged"
-                  type="checkbox"
-                  label="&markFlaggedCmd.label;"
-                  accesskey="&markFlaggedCmd.accesskey;"
-                  command="cmd_markAsFlagged"/>
-        <menuseparator/>
-        <menuitem label="&markAsJunkCmd.label;"
-                  accesskey="&markAsJunkCmd.accesskey;"
-                  command="cmd_markAsJunk"/>
-        <menuitem label="&markAsNotJunkCmd.label;"
-                  accesskey="&markAsNotJunkCmd.accesskey;"
-                  command="cmd_markAsNotJunk"/>
-        <menuitem label="&recalculateJunkScoreCmd.label;"
-                  accesskey="&recalculateJunkScoreCmd.accesskey;"
-                  command="cmd_recalculateJunkScore"/>
-        <menuitem label="&markAsShowRemoteCmd.label;"
-                  accesskey="&markAsShowRemoteCmd.accesskey;"
-                  command="cmd_markAsShowRemote"/>
-        <menuitem label="&markAsNotPhishCmd.label;"
-                  accesskey="&markAsNotPhishCmd.accesskey;"
-                  command="cmd_markAsNotPhish"/>
-      </menupopup>
-    </menu>
-    <menuseparator/>
-    <menuitem label="&downloadFlaggedCmd.label;"     accesskey="&downloadFlaggedCmd.accesskey;"    command="cmd_downloadFlagged"/>
-    <menuitem label="&downloadSelectedCmd.label;"    accesskey="&downloadSelectedCmd.accesskey;"   command="cmd_downloadSelected"/>
-    <menuseparator/>
-    <menuitem id="threadPaneContext-saveAs"
-        label="&contextSaveAs.label;"
-        accesskey="&contextSaveAs.accesskey;"
-        oncommand="MsgSaveAsFile();"/>
-    <menuitem id="threadPaneContext-printpreview"
-        label="&contextPrintPreview.label;"
-        accesskey="&contextPrintPreview.accesskey;"
-        oncommand="PrintEnginePrintPreview();"/>
-    <menuitem id="threadPaneContext-print"
-        label="&contextPrint.label;"
-        accesskey="&contextPrint.accesskey;"
-        oncommand="PrintEnginePrint();"/>
-    <menuitem id="threadPaneContext-delete"
-        command="cmd_delete"/>
-  </popup>
-
-  <popup id="folderPaneContext" onpopupshowing="return fillFolderPaneContextMenu();"
-    onpopuphiding="if (event.target == this) folderPaneOnPopupHiding();">
-
-    <menuitem id="folderPaneContext-getMessages"
-              label="&folderContextGetMessages.label;"
-              accesskey="&folderContextGetMessages.accesskey;"
-              oncommand="MsgGetMessage();"/>
-
-    <menuitem id="folderPaneContext-openNewWindow"
-              label="&folderContextOpenNewWindow.label;"
-              accesskey="&folderContextOpenNewWindow.accesskey;"
-              oncommand="MsgOpenNewWindowForFolder(null,-1);"/>
-
-    <menuitem id="folderPaneContext-searchMessages"
-              label="&folderContextSearchMessages.label;"
-              accesskey="&folderContextSearchMessages.accesskey;"
-              command="cmd_search"/>
-
-    <menuitem id="folderPaneContext-subscribe"
-        label="&folderContextSubscribe.label;"
-        accesskey="&folderContextSubscribe.accesskey;"
-        oncommand="MsgSubscribe();"/>
-    <menuitem id="folderPaneContext-newsUnsubscribe"
-        label="&folderContextUnsubscribe.label;"
-        accesskey="&folderContextUnsubscribe.accesskey;"
-        oncommand="MsgUnsubscribe();"/>
-
-    <menuseparator id="folderPaneContext-sep1"/>
-
-    <menuitem id="folderPaneContext-new"
-        label="&folderContextNew.label;"
-        accesskey="&folderContextNew.accesskey;"
-        oncommand="MsgNewFolder(NewFolder);"/>
-    <menuitem id="folderPaneContext-remove"
-              label="&folderContextRemove.label;"
-              accesskey="&folderContextRemove.accesskey;"
-              oncommand="MsgDeleteFolder();"/>
-    <menuitem id="folderPaneContext-rename"
-        label="&folderContextRename.label;"
-        accesskey="&folderContextRename.accesskey;"
-        oncommand="MsgRenameFolder();"/>
-
-    <menuitem id="folderPaneContext-compact"
-        label="&folderContextCompact.label;"
-        accesskey="&folderContextCompact.accesskey;"
-        oncommand="MsgCompactFolder(false);"/>
-    <menuitem id="folderPaneContext-markMailFolderAllRead"
-              label="&folderContextMarkMailFolderRead.label;"
-              accesskey="&folderContextMarkMailFolderRead.accesskey;"
-              oncommand="MsgMarkAllRead();"/>
-    <menuitem id="folderPaneContext-markNewsgroupAllRead"
-              label="&folderContextMarkNewsgroupRead.label;"
-              accesskey="&folderContextMarkNewsgroupRead.accesskey;"
-              oncommand="MsgMarkAllRead();"/>
-    <menuitem id="folderPaneContext-emptyTrash"
-        label="&folderContextEmptyTrash.label;"
-        accesskey="&folderContextEmptyTrash.accesskey;"
-        oncommand="MsgEmptyTrash();"/>
-    <menuitem id="folderPaneContext-emptyJunk"
-        label="&folderContextEmptyJunk.label;"
-        accesskey="&folderContextEmptyJunk.accesskey;"
-        oncommand="deleteAllInFolder('emptyJunk');"/>
-    <menuitem id="folderPaneContext-sendUnsentMessages"
-        label="&folderContextSendUnsentMessages.label;"
-        accesskey="&folderContextSendUnsentMessages.accesskey;"
-        oncommand="goDoCommand('cmd_sendUnsentMsgs')"/>
-
-    <menuseparator id="folderPaneContext-sep-edit"/>
-
-    <menuitem id="folderPaneContext-properties"
-        label="&folderContextProperties.label;"
-        accesskey="&folderContextProperties.accesskey;"
-        oncommand="MsgFolderProperties();"/>
-    <menuitem id="folderPaneContext-settings"
-              label="&folderContextSettings.label;"
-              accesskey="&folderContextSettings.accesskey;"
-              oncommand="MsgFolderProperties();"/>
-  </popup>
-
-  <popup id="messagePaneContext"
-     onpopupshowing="if (event.target != this) return true; gContextMenu = new nsContextMenu(this); return fillMessagePaneContextMenu();"
-     onpopuphiding="if (event.target == this) gContextMenu = null;">
-        <menuitem id="context-openlink"
-                  label="&openLinkCmd.label;"
-                  accesskey="&openLinkCmd.accesskey;"
-                  oncommand="gContextMenu.openLink();"/>
-        <menuitem id="context-openlinkintab"
-                  label="&openLinkCmdInTab.label;"
-                  accesskey="&openLinkCmdInTab.accesskey;"
-                  oncommand="gContextMenu.openLinkInTab(event.shiftKey);"/>
-    <menuseparator id="messagePaneContext-sep-link"/>
-    <menuitem id="context-selectall"
-              label="&selectAllCmd.label;"
-              accesskey="&selectAllCmd.accesskey;"
-              command="cmd_selectAll"/>
-    <menuitem id="context-copy"
-              label="&copyCmd.label;"
-              accesskey="&copyCmd.accesskey;"
-              command="cmd_copy"/>
-    <menuseparator id="messagePaneContext-sep-open"/>
-    <menuitem id="messagePaneContext-replySender"
-        label="&contextReplySender.label;"
-        accesskey="&contextReplySender.accesskey;"
-        oncommand="MsgReplySender(event);"/>
-    <menuitem id="messagePaneContext-replyNewsgroup"
-        label="&contextReplyNewsgroup.label;"
-        accesskey="&contextReplyNewsgroup.accesskey;"
-        oncommand="MsgReplyMessage(event);"/>
-    <menuitem id="messagePaneContext-replyAll"
-        label="&contextReplyAll.label;"
-        accesskey="&contextReplyAll.accesskey;"
-        oncommand="MsgReplyToAllRecipients(event);"/>
-    <menuitem id="messagePaneContext-forward"
-        label="&contextForward.label;"
-        accesskey="&contextForward.accesskey;"
-        oncommand="MsgForwardMessage(event);"/>
-    <menuitem id="messagePaneContext-editAsNew"
-        label="&contextEditAsNew.label;"
-        accesskey="&contextEditAsNew.accesskey;"
-        oncommand="MsgEditMessageAsNew();"/>
-    <menuseparator id="messagePaneContext-sep-reply"/>
-    <menuitem id="messagePaneContext-copyMessageUrl"
-        label="&copyMessageLocation.label;"
-        accesskey="&copyMessageLocation.accesskey;"
-        oncommand="CopyMessageUrl()"/>
-    <menu id="messagePaneContext-moveMenu"
-        label="&contextMoveMsgMenu.label;"
-        accesskey="&contextMoveMsgMenu.accesskey;"
-        sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-        sortDirection="ascending"
-        datasources="rdf:null">
-      <menupopup>
-        <menu label="&contextMoveCopyMsgRecentMenu.label;"
-              accesskey="&contextMoveCopyMsgRecentMenu.accesskey;"
-              sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-              sortDirection="ascending"
-              datasources="rdf:mailnewsrecentfolders"
-              ref="mailnewsrecentfolders:/">
-          <menupopup/>
-          <template>
-            <rule nc:CanFileMessages="true">
-              <menupopup>
-                <menuitem uri="..." class="folderMenuItem menuitem-iconic"
-                          label="rdf:http://home.netscape.com/NC-rdf#FolderTreeSimpleName"
-                          oncommand="MsgMoveMessage(event.target);"
-                          SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                          BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                          IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                          IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                          ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-              </menupopup>
-            </rule>
-          </template>
-        </menu>
-        <menuseparator/>
-      </menupopup>
-      <template>
-        <rule nc:NoSelect="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name">
-              <menupopup>
-                <menuitem label="&fileHereMenu.label;" accesskey="&fileHereMenu.accesskey;" disabled="true"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:NoSelect="true">
-          <menupopup>
-            <menuitem uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name" disabled="true"/>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-              SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-              BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-              IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-              IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-              ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup>
-                <menuitem label="&fileHereMenu.label;" accesskey="&fileHereMenu.accesskey;"
-                  oncommand="MsgMoveMessage(event.target.parentNode.parentNode)"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessagesOnServer="false">
-          <!-- don't show servers (nntp & any others) which does not allow message filing -->
-          <!-- File, Move & Copy menus -->
-        </rule>
-        <rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
-          <!-- note, there is no "file here" -->
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-                  SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                  BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                  IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                  IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                  ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup/>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true">
-          <menupopup>
-            <menuitem uri="..." class="folderMenuItem menuitem-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="MsgMoveMessage(event.target)"
-              SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-              BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-              IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-              IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-              ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-          </menupopup>
-        </rule>
-      </template>
-    </menu>
-    <menu id="messagePaneContext-copyMenu"
-      label="&contextCopyMsgMenu.label;"
-      accesskey="&contextCopyMsgMenu.accesskey;"
-      sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-      sortDirection="ascending"
-      datasources="rdf:null">
-      <menupopup>
-        <menu label="&contextMoveCopyMsgRecentMenu.label;"
-              accesskey="&contextMoveCopyMsgRecentMenu.accesskey;"
-              sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-              sortDirection="ascending"
-              datasources="rdf:mailnewsrecentfolders"
-              ref="mailnewsrecentfolders:/">
-          <menupopup/>
-          <template>
-            <rule nc:CanFileMessages="true">
-              <menupopup>
-                <menuitem uri="..." class="folderMenuItem menuitem-iconic"
-                          label="rdf:http://home.netscape.com/NC-rdf#FolderTreeSimpleName"
-                          oncommand="MsgCopyMessage(event.target);"
-                          SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                          BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                          IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                          IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                          ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-              </menupopup>
-            </rule>
-          </template>
-        </menu>
-        <menuseparator/>
-      </menupopup>
-      <template>
-        <rule nc:NoSelect="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name">
-              <menupopup>
-                <menuitem label="&copyHereMenu.label;" accesskey="&copyHereMenu.accesskey;" disabled="true"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:NoSelect="true">
-          <menupopup>
-            <menuitem uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name" disabled="true"/>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-              SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-              BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-              IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-              IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-              ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup>
-                <menuitem label="&copyHereMenu.label;" accesskey="&copyHereMenu.accesskey;"
-                  oncommand="MsgCopyMessage(event.target.parentNode.parentNode)"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessagesOnServer="false">
-          <!-- don't show servers (nntp & any others) which does not allow message filing -->
-          <!-- File, Move & Copy menus -->
-        </rule>
-        <rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
-          <!-- note, there is no "file here" -->
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-                  SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                  BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                  IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                  IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                  ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup/>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true">
-          <menupopup>
-            <menuitem uri="..." class="folderMenuItem menuitem-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-              oncommand="MsgCopyMessage(event.target)"
-              SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-              BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-              IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-              IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-              ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-          </menupopup>
-        </rule>
-      </template>
-    </menu>
-    <menuseparator id="messagePaneContext-sep-tags"/>
-    <menu id="messagePaneContext-tags" label="&tagMenu.label;" accesskey="&tagMenu.accesskey;">
-      <menupopup id="messagePaneContext-tagpopup" onpopupshowing="InitMessageTags(this)">
-        <menuitem id="messagePaneContext-tagRemoveAll" oncommand="RemoveAllMessageTags();"/>
-        <menuseparator/>
-        <menuseparator/>
-        <menuitem id="messagePaneContext-tagCustomize"
-                  label="&tagCustomize.label;"
-                  accesskey="&tagCustomize.accesskey;"
-                  oncommand="goPreferences('tags_pane');"/>
-      </menupopup>
-    </menu>
-    <menu id="messagePaneContext-mark" label="&markMenu.label;" accesskey="&markMenu.accesskey;">
-      <menupopup onpopupshowing="InitMessageMark()">
-        <menuitem id="messagePaneContext-markRead"
-                  type="checkbox"
-                  label="&markAsReadCmd.label;"
-                  accesskey="&markAsReadCmd.accesskey;"
-                  command="cmd_markAsRead"/>
-        <menuitem label="&markThreadAsReadCmd.label;"
-                  accesskey="&markThreadAsReadCmd.accesskey;"
-                  command="cmd_markThreadAsRead"/>
-        <menuitem label="&markReadByDateCmd.label;"
-                  accesskey="&markReadByDateCmd.accesskey;"
-                  command="cmd_markReadByDate"/>
-        <menuitem label="&markAllReadCmd.label;"
-                  accesskey="&markAllReadCmd.accesskey;"
-                  command="cmd_markAllRead"/>
-        <menuseparator/>
-        <menuitem id="messagePaneContext-markFlagged"
-                  type="checkbox"
-                  label="&markFlaggedCmd.label;"
-                  accesskey="&markFlaggedCmd.accesskey;"
-                  command="cmd_markAsFlagged"/>
-        <menuseparator/>
-        <menuitem label="&markAsJunkCmd.label;"
-                  accesskey="&markAsJunkCmd.accesskey;"
-                  command="cmd_markAsJunk"/>
-        <menuitem label="&markAsNotJunkCmd.label;"
-                  accesskey="&markAsNotJunkCmd.accesskey;"
-                  command="cmd_markAsNotJunk"/>
-        <menuitem label="&recalculateJunkScoreCmd.label;"
-                  accesskey="&recalculateJunkScoreCmd.accesskey;"
-                  command="cmd_recalculateJunkScore"/>
-        <menuitem label="&markAsShowRemoteCmd.label;"
-                  accesskey="&markAsShowRemoteCmd.accesskey;"
-                  command="cmd_markAsShowRemote"/>
-        <menuitem label="&markAsNotPhishCmd.label;"
-                  accesskey="&markAsNotPhishCmd.accesskey;"
-                  command="cmd_markAsNotPhish"/>
-      </menupopup>
-    </menu>
-    <menuseparator id="messagePaneContext-sep-mark"/>
-    <menuitem id="messagePaneContext-saveAs"
-        label="&contextSaveAs.label;"
-        accesskey="&contextSaveAs.accesskey;"
-        oncommand="MsgSaveAsFile();"/>
-    <menuitem id="messagePaneContext-printpreview"
-        label="&contextPrintPreview.label;"
-        accesskey="&contextPrintPreview.accesskey;"
-        oncommand="PrintEnginePrintPreview();"/>
-    <menuitem id="messagePaneContext-print"
-        label="&contextPrint.label;"
-        accesskey="&contextPrint.accesskey;"
-        oncommand="PrintEnginePrint();"/>
-    <menuitem id="messagePaneContext-delete"
-        command="cmd_delete"/>
-    <menuseparator id="messagePaneContext-sep-edit"/>
+    <menuitem id="mailContext-saveAs"
+              label="&contextSaveAs.label;"
+              accesskey="&contextSaveAs.accesskey;"
+              oncommand="MsgSaveAsFile();"/>
+    <menuitem id="mailContext-delete"
+              command="cmd_delete"/>
+    <menuseparator id="mailContext-sep-print"/>
+    <menuitem id="mailContext-printpreview"
+              label="&contextPrintPreview.label;"
+              accesskey="&contextPrintPreview.accesskey;"
+              oncommand="PrintEnginePrintPreview();"/>
+    <menuitem id="mailContext-print"
+              label="&contextPrint.label;"
+              accesskey="&contextPrint.accesskey;"
+              oncommand="PrintEnginePrint();"/>
+    <menuseparator id="mailContext-sep-edit"/>
     <menuitem id="context-copylink"
               label="&copyLinkCmd.label;"
               accesskey="&copyLinkCmd.accesskey;"
               command="cmd_copyLink"/>
     <menuitem id="context-copyimage"
               label="&copyImageCmd.label;"
               accesskey="&copyImageCmd.accesskey;"
               command="cmd_copyImage"/>
-        <menuitem id="context-viewimage"
-                  label="&viewImageCmd.label;"
-                  accesskey="&viewImageCmd.accesskey;"
-                  oncommand="gContextMenu.viewImage();"/>
+    <menuitem id="context-viewimage"
+              label="&viewImageCmd.label;"
+              accesskey="&viewImageCmd.accesskey;"
+              oncommand="gContextMenu.viewMedia();"/>
     <menuitem id="context-addemail"
               label="&AddToAddressBook.label;"
               accesskey="&AddToAddressBook.accesskey;"
               oncommand="AddEmailToAddressBook(gContextMenu.getEmail(), gContextMenu.linkText());"/>
-        <menuseparator id="messagePaneContext-sep-image"/>
+    <menuseparator id="mailContext-sep-image"/>
     <menuitem id="context-composeemailto"
               label="&SendMailTo.label;"
               accesskey="&SendMailTo.accesskey;"
               oncommand="SendMailTo(gContextMenu.getEmail());"/>
-        <menuitem id="context-createfilterfrom"
-                  label="&CreateFilterFrom.label;"
-                  accesskey="&CreateFilterFrom.accesskey;"
-                  oncommand="CreateFilterFromMail(gContextMenu.getEmail());"/>
+    <menuitem id="context-createfilterfrom"
+              label="&CreateFilterFrom.label;"
+              accesskey="&CreateFilterFrom.accesskey;"
+              oncommand="CreateFilterFromMail(gContextMenu.getEmail());"/>
     <menuitem id="context-copyemail"
               label="&copyEmailCmd.label;"
               accesskey="&copyEmailCmd.accesskey;"
               oncommand="gContextMenu.copyEmail();"/>
-    <menuseparator id="messagePaneContext-sep-copy"/>
+    <menuseparator id="mailContext-sep-copy"/>
     <menuitem id="context-savelink"
               label="&saveLinkCmd.label;"
               accesskey="&saveLinkCmd.accesskey;"
               oncommand="gContextMenu.saveLink();"/>
     <menuitem id="context-saveimage"
               label="&saveImageCmd.label;"
               accesskey="&saveImageCmd.accesskey;"
               oncommand="gContextMenu.saveImage();"/>
-        <menuitem id="context-bookmarklink"
-                  label="&bookmarkLinkCmd.label;"
-                  accesskey="&bookmarkLinkCmd.accesskey;"
-                  oncommand="initBMService();
-                             BookmarksUtils.addBookmark(gContextMenu.linkURL(),
-                                                        gContextMenu.linkText());"/>
-</popup>
+    <menuitem id="context-bookmarklink"
+              label="&bookmarkLinkCmd.label;"
+              accesskey="&bookmarkLinkCmd.accesskey;"
+              oncommand="initBMService();
+                         BookmarksUtils.addBookmark(gContextMenu.linkURL(),
+                                                    gContextMenu.linkText());"/>
+  </popup>
 
 <menubar id="mail-menubar" grippytooltiptext="&menuBar.tooltip;">
   <menu id="menu_File" >
     <menupopup id="menu_FilePopup" onpopupshowing="file_init();">
       <menu id="menu_New">
         <menupopup id="menu_NewPopup" onpopupshowing="menu_new_init();">
           <menuitem label="&newNewMsgCmd.label;"
                     accesskey="&newNewMsgCmd.accesskey;"
--- a/mailnews/base/resources/content/messageWindow.xul
+++ b/mailnews/base/resources/content/messageWindow.xul
@@ -110,17 +110,17 @@
     <key keycode="VK_ESCAPE" oncommand="window.close();"/>
   </keyset>
 
   <popupset>
     <popup id="messageIdContext"/>
 
     <popup id="emailAddressPopup"/>
 
-    <popup id="messagePaneContext"/>
+    <popup id="mailContext"/>
   </popupset>
 
   <popup id="attachmentListContext"/>
 
   <popup id="copyUrlPopup"/>
 
   <popup id="toolbar-context-menu"/>
 
@@ -137,20 +137,28 @@
         ondragdrop="nsDragAndDrop.drop(event, messagepaneObserver);"
         ondragexit="nsDragAndDrop.dragExit(event, messagepaneObserver);">
 
     <deck id="msgNotificationBar"/>
 
     <hbox id="msgHeaderView"/>
 
     <!-- message view -->
-    <browser id="messagepane" context="messagePaneContext"
-      tooltip="aHTMLTooltip" 
-      style="height: 0px; min-height: 1px" flex="1" name="messagepane" 
-      disablesecurity="true" disablehistory="true" type="content-primary" 
-      onresize="return messagePaneOnResize(event);" autofind="false"
-      src="about:blank" onclick="return messagePaneOnClick(event);"/>
+    <browser id="messagepane"
+             name="messagepane"
+             height="0"
+             flex="1"
+             minwidth="1"
+             minheight="1"
+             context="mailContext"
+             tooltip="aHTMLTooltip"
+             disablesecurity="true"
+             disablehistory="true"
+             autofind="false"
+             type="content-primary"
+             onresize="return messagePaneOnResize(event);"
+             onclick="return messagePaneOnClick(event);"/>
   </vbox>  
 </vbox>
 
   <statusbar class="chromeclass-status" id="status-bar"/>
 
 </window>
--- a/mailnews/base/resources/content/messenger.xul
+++ b/mailnews/base/resources/content/messenger.xul
@@ -117,31 +117,29 @@
   <broadcaster id="Communicator:WorkMode"/>
   <!-- Edit Menu -->
 </broadcasterset>
 
 <keyset id="mailKeys">
   <keyset id="tasksKeys"/>
 </keyset>
 
-<popup id="threadPaneContext"/>
+<popup id="mailContext"/>
 <popup id="folderPaneContext"/>
 <popup id="attachmentListContext"/>
 <tooltip id="attachmentListTooltip"/>
 
 <popup id="copyUrlPopup"/>
 
 <popup id="messageIdContext"/>
 
 <popup id="emailAddressPopup"/>
 
 <tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
 
-<popup id="messagePaneContext"/>
-
 <popup id="toolbar-context-menu"/>
 
   <toolbox id="mail-toolbox" class="toolbox-top">
     <menubar id="mail-menubar"/>
     <toolbar id="msgToolbar"/>
     <toolbar id="msgLocationToolbar"/>
   </toolbox>
 
@@ -175,17 +173,17 @@
           <hbox id="threadPaneBox">
             <tree id="threadTree"
                   treelines="true"
                   keepcurrentinview="true"
                   flex="1"
                   minwidth="100"
                   width="100"
                   persist="width"
-                  context="threadPaneContext"
+                  context="mailContext"
                   class="window-focusborder"
                   focusring="false"/>
           </hbox>
           <!-- extensions may overlay in additional panels; don't assume that there are only 2! -->
         </deck>
 
         <!-- if you change this id, please change GetThreadAndMessagePaneSplitter() and MsgToggleMessagePane() -->
         <splitter id="threadpane-splitter" collapse="after" persist="state hidden" collapsed="true"
@@ -195,21 +193,29 @@
 
         <vbox id="messagepanebox" flex="2" minheight="100" height="200"
               minwidth="100" width="200" persist="height width"
               class="window-focusborder" focusring="false">
           <deck id="msgNotificationBar"/>
 
           <hbox id="msgHeaderView"/>
 
-          <browser id="messagepane" name="messagepane" height="0" flex="1"
+          <browser id="messagepane"
+                   name="messagepane"
+                   height="0"
+                   flex="1"
+                   minwidth="1"
+                   minheight="1"
                    tooltip="aHTMLTooltip"
-                   context="messagePaneContext" minwidth="1" minheight="1"
-                   disablesecurity="true" disablehistory="true" autofind="false"
+                   context="mailContext"
+                   disablesecurity="true"
+                   disablehistory="true"
+                   autofind="false"
+                   type="content-primary"
                    onresize="return messagePaneOnResize(event);"
-                   type="content-primary" onclick="return messagePaneOnClick(event);"/>
+                   onclick="return messagePaneOnClick(event);"/>
         </vbox>
       </box>
     </box>
   </box>
 
   <statusbar id="status-bar" class="chromeclass-status mailwindow-statusbar"/>
 </window>
--- a/mailnews/base/resources/content/msgMail3PaneWindow.js
+++ b/mailnews/base/resources/content/msgMail3PaneWindow.js
@@ -906,22 +906,16 @@ function UnloadPanes()
 }
 
 function InitializeDataSources()
 {
   //Setup common mailwindow stuff.
   AddDataSources();
 
   SetupMoveCopyMenus('goMenu', accountManagerDataSource, folderDataSource);
-
-  //To threadpane move context menu
-  SetupMoveCopyMenus('threadPaneContext-moveMenu', accountManagerDataSource, folderDataSource);
-
-  //To threadpane copy content menu
-  SetupMoveCopyMenus('threadPaneContext-copyMenu', accountManagerDataSource, folderDataSource);
 }
 
 function OnFolderUnreadColAttrModified(event)
 {
   if (event.attrName == "hidden")
   {
     var folderNameCell = document.getElementById("folderNameCell");
     var label = {"true": "?folderTreeName", "false": "?folderTreeSimpleName"};
--- a/suite/common/mac/platformCommunicatorOverlay.xul
+++ b/suite/common/mac/platformCommunicatorOverlay.xul
@@ -68,18 +68,17 @@
   <key id="key_findTypeText"
        key="&findTypeTextCmd.key;"/>
   <key id="key_findTypeLinks"
        key="&findTypeLinksCmd.key;"/>
 
   <menuitem id="printPreviewMenuItem" hidden="true"/>
   <menuitem id="printPreviewMenuItemToolbar" hidden="true"/>
   <menuitem id="printPreviewAddressBook" hidden="true"/>
-  <menuitem id="threadPaneContext-printpreview" hidden="true"/>
-  <menuitem id="messagePaneContext-printpreview" hidden="true"/>
+  <menuitem id="mailContext-printpreview" hidden="true"/>
 
   <!-- Tasks Commands -->
   <commandset id="tasksCommands"> 
     <command id="cmd_minimizeWindow" oncommand="window.minimize();"/>
     <command id="cmd_zoomWindow" oncommand="ZoomCurrentWindow();"/>
   </commandset>
 
   <!-- Tasks Keys -->
--- a/suite/common/nsContextMenu.js
+++ b/suite/common/nsContextMenu.js
@@ -82,21 +82,16 @@ nsContextMenu.prototype = {
     // onDestroy is a no-op at this point.
     onDestroy : function () {
     },
     // Initialize context menu.
     initMenu : function ( popup ) {
         // Save menu.
         this.menu = popup;
 
-        const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-        if ( document.popupNode.namespaceURI == xulNS ) {
-          this.shouldDisplay = false;
-          return;
-        }
         // Get contextual info.
         this.setTarget( document.popupNode, document.popupRangeParent,
                         document.popupRangeOffset );
 
         this.isTextSelected = this.isTextSelection();
         this.isContentSelected = this.isContentSelection();
 
         this.initPopupURL();
@@ -329,16 +324,21 @@ nsContextMenu.prototype = {
         this.showItem( "context-media-mute", onMedia && !this.target.muted );
         this.showItem( "context-media-unmute", onMedia && this.target.muted );
         this.showItem( "context-media-showcontrols", onMedia && !this.target.controls );
         this.showItem( "context-media-hidecontrols", onMedia && this.target.controls );
         this.showItem( "context-media-sep-commands", onMedia );
     },
     // Set various context menu attributes based on the state of the world.
     setTarget : function ( node, rangeParent, rangeOffset ) {
+        const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+        if ( node.namespaceURI == xulNS ) {
+          this.shouldDisplay = false;
+          return;
+        }
         // Initialize contextual info.
         this.onImage    = false;
         this.onLoadedImage = false;
         this.onStandaloneImage = false;
         this.onCanvas          = false;
         this.onVideo           = false;
         this.onAudio           = false;
         this.onMetaDataItem = false;
--- a/suite/common/permissions/imageContextOverlay.xul
+++ b/suite/common/permissions/imageContextOverlay.xul
@@ -114,17 +114,17 @@
         } catch (e) {}
       },
 
       addContextMenuItemListeners : function (aEvent) {
         var contextPopup = document.getElementById("contentAreaContextSet");
         if (contextPopup)
           contextPopup.addEventListener("popupshowing", cookieContextMenu.initImageBlocking, false);
 
-        var mailContextPopup = document.getElementById("messagePaneContext");
+        var mailContextPopup = document.getElementById("mailContext");
         if (mailContextPopup)
           mailContextPopup.addEventListener("popupshowing", cookieContextMenu.initImageBlocking, false);
       }
     }
 
     window.addEventListener("load", cookieContextMenu.addContextMenuItemListeners, false);
    ]]>
   </script>
@@ -134,18 +134,18 @@
     <menuitem id="context-blockimage"
               oncommand="cookieContextMenu.toggleImageBlocking(true);"
               insertafter="context-viewimage"/>
     <menuitem id="context-unblockimage"
               oncommand="cookieContextMenu.toggleImageBlocking(false);"
               insertafter="context-viewimage"/>
   </popup>
 
-  <!-- Mail Message Pane context menu -->
-  <popup id="messagePaneContext">
+  <!-- Mail context menu -->
+  <popup id="mailContext">
     <menuitem id="context-blockimage"
               oncommand="cookieContextMenu.toggleImageBlocking(true);"
               insertafter="context-viewimage"/>
     <menuitem id="context-unblockimage"
               oncommand="cookieContextMenu.toggleImageBlocking(false);"
               insertafter="context-viewimage"/>
   </popup>