Bug 1589892 - Port |Bug 440616 (part 3 v1) Clean up Thunderbird's global scope a bit more| to SeaMonkey. r=frg a=frg DONTBUILD CLOSED TREE
authorIan Neal <iann_cvs@blueyonder.co.uk>
Thu, 14 Nov 2019 21:02:01 +0100
changeset 32365 b066b5e8868cfc79d802338e9d03492ac5e8f502
parent 32364 328b908326fa7075f4930dd4b92bf94be6243b69
child 32366 b05f05a590f40660861152d6e31aa6b618797add
push id229
push userfrgrahl@gmx.net
push dateThu, 14 Nov 2019 20:02:28 +0000
treeherdercomm-esr60@b05f05a590f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg, frg
bugs1589892, 440616
Bug 1589892 - Port |Bug 440616 (part 3 v1) Clean up Thunderbird's global scope a bit more| to SeaMonkey. r=frg a=frg DONTBUILD CLOSED TREE
suite/mailnews/content/msgHdrViewOverlay.js
--- a/suite/mailnews/content/msgHdrViewOverlay.js
+++ b/suite/mailnews/content/msgHdrViewOverlay.js
@@ -17,36 +17,31 @@ ChromeUtils.import("resource:///modules/
 // the message headers for a selected message remain as fast as possible. In particular,
 // right now, we only introduce one reflow per message. i.e. if you click on a message in the thread
 // pane, we batch up all the changes for displaying the header pane (to, cc, attachements button, etc.)
 // and we make a single pass to display them. It's critical that we maintain this one reflow per message
 // view in the message header pane.
 ////////////////////////////////////////////////////////////////////////////////////
 
 var gViewAllHeaders = false;
-var gShowOrganization = false;
-var gShowUserAgent = false;
-var gShowReferences = false;
-var gShowMessageId = false;
 var gCollectIncoming = false;
 var gCollectOutgoing = false;
 var gCollectNewsgroup = false;
 var gCollapsedHeaderViewMode = false;
 var gCollectAddressTimer = null;
 var gBuildAttachmentsForCurrentMsg = false;
 var gBuildAttachmentPopupForCurrentMsg = true;
 var gBuiltExpandedView = false;
 var gBuiltCollapsedView = false;
 var gMessengerBundle;
 
 // Globals for setFromBuddyIcon().
 var gFileHandler;
 var gProfileDirURL;
 
-var gExtraExpandedHeaders;
 // Show the friendly display names for people I know, instead of the name + email address.
 var gShowCondensedEmailAddresses;
 
 var msgHeaderParser = Cc["@mozilla.org/messenger/headerparser;1"]
                         .getService(Ci.nsIMsgHeaderParser);
 var abAddressCollector = null;
 
 // other components may listen to on start header & on end header notifications for each message we display
@@ -187,57 +182,52 @@ function initializeHeaderViewTables()
   }
 
   for (let index = 0; index < gExpandedHeaderList.length; index++)
   {
     var headerName = gExpandedHeaderList[index].name;
     gExpandedHeaderView[headerName] = new createHeaderEntry('expanded', gExpandedHeaderList[index]);
   }
 
-  var extraHeaders = gExtraExpandedHeaders.match(/[^ ]+/g);
+  var extraHeaders = Services.prefs.getCharPref("mailnews.headers.extraExpandedHeaders").match(/[^ ]+/g);
   if (extraHeaders) {
     for (let index = 0; index < extraHeaders.length; index++)
     {
       let extraHeader = extraHeaders[index];
       gExpandedHeaderView[extraHeader.toLowerCase()] = new createNewHeaderView(extraHeader, extraHeader + ':');
     }
   }
 
-  if (gShowOrganization)
+  if (Services.prefs.getBoolPref("mailnews.headers.showOrganization"))
   {
     let organizationEntry = {name:"organization", outputFunction:updateHeaderValue};
     gExpandedHeaderView[organizationEntry.name] = new createHeaderEntry('expanded', organizationEntry);
   }
 
-  if (gShowUserAgent)
+  if (Services.prefs.getBoolPref("mailnews.headers.showUserAgent"))
   {
     let userAgentEntry = {name:"user-agent", outputFunction:updateHeaderValue};
     gExpandedHeaderView[userAgentEntry.name] = new createHeaderEntry('expanded', userAgentEntry);
   }
 
-  if (gShowMessageId)
+  if (Services.prefs.getBoolPref("mailnews.headers.showMessageId"))
   {
     let messageIdEntry = {name:"message-id", outputFunction:OutputMessageIds};
     gExpandedHeaderView[messageIdEntry.name] = new createHeaderEntry('expanded', messageIdEntry);
   }
 }
 
 function OnLoadMsgHeaderPane()
 {
   // load any preferences that at are global with regards to
   // displaying a message...
   gCollectIncoming = Services.prefs.getBoolPref("mail.collect_email_address_incoming");
   gCollectNewsgroup = Services.prefs.getBoolPref("mail.collect_email_address_newsgroup");
   gCollectOutgoing = Services.prefs.getBoolPref("mail.collect_email_address_outgoing");
   gShowCondensedEmailAddresses = Services.prefs.getBoolPref("mail.showCondensedAddresses");
-  gShowUserAgent = Services.prefs.getBoolPref("mailnews.headers.showUserAgent");
-  gShowOrganization = Services.prefs.getBoolPref("mailnews.headers.showOrganization");
-  gShowReferences = Services.prefs.getBoolPref("mailnews.headers.showReferences");
-  gShowMessageId = Services.prefs.getBoolPref("mailnews.headers.showMessageId");
-  gExtraExpandedHeaders = Services.prefs.getCharPref("mailnews.headers.extraExpandedHeaders");
 
   Services.prefs.addObserver("mail.showCondensedAddresses", MsgHdrViewObserver);
 
   initializeHeaderViewTables();
 
   // Add an address book listener so we can update the header view when things
   // change.
   Cc["@mozilla.org/abmanager;1"]
@@ -972,18 +962,19 @@ function UpdateMessageHeaders()
         }
 
         headerEntry = gExpandedHeaderView[headerName];
       }
     } // if we are in expanded view....
 
     if (headerEntry)
     {
+      let show = Services.prefs.getBoolPref("mailnews.headers.showReferences");
       if (headerName == "references" &&
-          !(gViewAllHeaders || gShowReferences ||
+          !(gViewAllHeaders || show ||
             (gDBView.msgFolder && gDBView.msgFolder.server.type == "nntp")))
       {
         // hide references header if view all headers mode isn't selected, the pref show references is
         // deactivated and the currently displayed message isn't a newsgroup posting
         headerEntry.valid = false;
       }
       else
       {