Bug 660882 - search window does not allow to open message from result list [currentHeaderData is not defined]. r=Mnyromyr sr=Neil
authorJens Hatlak <jh@junetz.de>
Wed, 08 Jun 2011 07:37:45 +0200
changeset 7902 aeae283c99ef0c2d4d6d6ca05f9bb613a7287c25
parent 7901 920dffc43f304ce0fc34d7cabf5b571d5be446a1
child 7903 7f3f984ba3a130e25f138070530f52b56cb5f6a4
push id6071
push userjh@junetz.de
push dateWed, 08 Jun 2011 05:41:05 +0000
treeherdercomm-central@aeae283c99ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMnyromyr, Neil
bugs660882
Bug 660882 - search window does not allow to open message from result list [currentHeaderData is not defined]. r=Mnyromyr sr=Neil
suite/mailnews/mailWindowOverlay.js
--- a/suite/mailnews/mailWindowOverlay.js
+++ b/suite/mailnews/mailWindowOverlay.js
@@ -207,17 +207,17 @@ function view_init()
   if (view_menuitem)
     view_menuitem.setAttribute("disabled", gAccountCentralLoaded);
 
   var threads_menuitem = document.getElementById("viewMessagesMenu");
   if (threads_menuitem)
     threads_menuitem.setAttribute("disabled", gAccountCentralLoaded);
 
   // Initialize the Message Body menuitem
-  var isFeed = IsFeedItem();
+  var isFeed = gFolderDisplay.selectedMessageIsFeed;
   document.getElementById('viewBodyMenu').hidden = isFeed;
 
   // Initialize the Show Feed Summary menu
   var viewFeedSummary = document.getElementById('viewFeedSummary');
   var winType = document.documentElement.getAttribute('windowtype');
   if (winType != "mail:3pane")
     viewFeedSummary.hidden = !gShowFeedSummary;
   else
@@ -327,21 +327,18 @@ function InitViewMessagesMenu()
   var ignoredTheadsMenuItem = document.getElementById("viewIgnoredThreadsMenuItem");
   if (ignoredTheadsMenuItem)
     ignoredTheadsMenuItem.setAttribute("checked", (viewFlags & nsMsgViewFlagsType.kShowIgnored) != 0);
 }
 
 function InitMessageMenu()
 {
   var aMessage = GetFirstSelectedMessage();
-  var isNews = false;
-  if(aMessage) {
-      isNews = IsNewsMessage(aMessage);
-  }
-  var isFeed = IsFeedItem();
+  var isNews = gFolderDisplay.selectedMessageIsNews;
+  var isFeed = gFolderDisplay.selectedMessageIsFeed;
 
   // We show Reply to Newsgroups only for news messages.
   var replyNewsgroupMenuItem = document.getElementById("replyNewsgroupMainMenu");
   if(replyNewsgroupMenuItem)
   {
       replyNewsgroupMenuItem.setAttribute("hidden", isNews ? "" : "true");
   }
 
@@ -468,17 +465,17 @@ function InitViewHeadersMenu()
     menuitem.setAttribute("checked", "true"); 
 }
 
 function InitViewBodyMenu()
 {
   var html_as = 0;
   var prefer_plaintext = false;
   var disallow_classes = 0;
-  var isFeed = IsFeedItem();
+  var isFeed = gFolderDisplay.selectedMessageIsFeed;
   const defaultIDs = ["bodyAllowHTML",
                       "bodySanitized",
                       "bodyAsPlaintext"];
   const rssIDs = ["bodyFeedSummaryAllowHTML",
                   "bodyFeedSummarySanitized",
                   "bodyFeedSummaryAsPlaintext"];
   var menuIDs = isFeed ? rssIDs : defaultIDs;
   try
@@ -533,24 +530,16 @@ function IsNewsMessage(messageUri)
   return (/^news-message:/.test(messageUri));
 }
 
 function IsImapMessage(messageUri)
 {
   return (/^imap-message:/.test(messageUri));
 }
 
-function IsFeedItem()
-{
-  return (GetFirstSelectedMessage() &&
-          ((gMsgFolderSelected &&
-            gMsgFolderSelected.server.type == 'rss') ||
-           'content-base' in currentHeaderData));
-}
-
 function SetMenuItemLabel(menuItemId, customLabel)
 {
   var menuItem = document.getElementById(menuItemId);
   if (menuItem)
     menuItem.setAttribute('label', customLabel);
 }
 
 function RemoveAllMessageTags()
@@ -1687,17 +1676,18 @@ function MsgOpenNewWindowForFolder(uri, 
      mailWindowService.openMessengerWindowWithUri("mail:3pane", uriToOpen, keyToSelect);
   }
 }
 
 function MsgOpenSelectedMessages()
 {
   // Toggle message body (rss summary) and content-base url in message
   // pane per pref, otherwise open summary or web page in new window.
-  if (IsFeedItem() && GetFeedOpenHandler() == 2) {
+  if (gFolderDisplay.selectedMessageIsFeed && GetFeedOpenHandler() == 2)
+  {
     FeedSetContentViewToggle();
     return;
   }
 
   var dbView = GetDBView();
   var indices = GetSelectedIndices(dbView);
   var numMessages = indices.length;
 
@@ -3090,17 +3080,17 @@ function FeedSetContentViewToggle()
 }
 
 // Check message format
 function FeedCheckContentFormat()
 {
   var contentWindowDoc = window.top.content.document;
 
   // Not an rss message
-  if (!IsFeedItem())
+  if (!gFolderDisplay.selectedMessageIsFeed)
     return false;
 
   // Thunderbird 2 rss messages with 'Show article summary' not selected,
   // ie message body constructed to show web page in an iframe, can't show
   // a summary - notify user.
   var rssIframe = contentWindowDoc.getElementById('_mailrssiframe');
   if (rssIframe) {
     if (gShowFeedSummaryToggle || pref.getIntPref("rss.show.summary") == 1)