Bug 1510800 - Enable ESLint on all of mail/ except mail/test. r=aceman
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 29 Nov 2018 11:28:04 +1300
changeset 33817 b3c0c0a2e783ae7ef151b8a5312eafc2cb36f8af
parent 33816 dd4e2acab2ab99e6f53b72268d8b72aad1745632
child 33818 785c09b1b20ec61730025cfbdaca35f4c405a291
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersaceman
bugs1510800
Bug 1510800 - Enable ESLint on all of mail/ except mail/test. r=aceman
.eslintignore
mail/branding/nightly/thunderbird-branding.js
mail/branding/thunderbird/thunderbird-branding.js
mail/extensions/mailviews/content/mailViewList.js
mail/extensions/mailviews/content/mailViewSetup.js
mail/extensions/mailviews/content/msgViewPickerOverlay.js
mail/extensions/smime/content/msgCompSMIMEOverlay.js
mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -43,28 +43,25 @@ mailnews/mime/*
 mailnews/news/*
 mailnews/test/*
 
 # mailnews/extensions exclusions
 mailnews/extensions/*
 !mailnews/extensions/newsblog
 
 # mail exclusions
-mail/app/**
+mail/app/profile/all-thunderbird.js
+mail/app/profile/channel-prefs.js
+mail/app/profile/prefs.js
 mail/base/content/protovis-r2.6-modded.js
-mail/branding/**
-mail/config/**
-mail/extensions/**
-mail/installer/**
-mail/locales/**
+mail/branding/nightly/thunderbird-branding.js
+mail/branding/thunderbird/thunderbird-branding.js
+mail/components/im/all-im.js
+mail/locales/en-US/all-l10n.js
 mail/test/**
-mail/themes/**
-
-# prefs files
-mail/components/im/all-im.js
 
 # calendar/ exclusions
 
 # prefs files
 calendar/lightning/content/lightning.js
 
 # third party library
 calendar/base/modules/ical.js
--- a/mail/branding/nightly/thunderbird-branding.js
+++ b/mail/branding/nightly/thunderbird-branding.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Default start page
-pref("mailnews.start_page.url","https://live.thunderbird.net/%APP%/start?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%");
+pref("mailnews.start_page.url", "https://live.thunderbird.net/%APP%/start?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%");
 
 // start page override to load after an update
-pref("mailnews.start_page.override_url","https://live.thunderbird.net/%APP%/whatsnew?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%");
+pref("mailnews.start_page.override_url", "https://live.thunderbird.net/%APP%/whatsnew?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%");
 
 // Interval: Time between checks for a new version (in seconds)
 // nightly=1 hour, official=24 hours
 pref("app.update.interval", 3600);
 
 // The time interval between the downloading of mar file chunks in the
 // background (in seconds)
 pref("app.update.download.backgroundInterval", 60);
--- a/mail/branding/thunderbird/thunderbird-branding.js
+++ b/mail/branding/thunderbird/thunderbird-branding.js
@@ -1,13 +1,13 @@
 // Default start page
-pref("mailnews.start_page.url","https://live.thunderbird.net/%APP%/start?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%");
+pref("mailnews.start_page.url", "https://live.thunderbird.net/%APP%/start?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%");
 
 // start page override to load after an update
-pref("mailnews.start_page.override_url","https://live.thunderbird.net/%APP%/whatsnew?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%");
+pref("mailnews.start_page.override_url", "https://live.thunderbird.net/%APP%/whatsnew?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%");
 
 // Interval: Time between checks for a new version (in seconds)
 // nightly=8 hours, official=24 hours
 pref("app.update.interval", 86400);
 
 // The time interval between the downloading of mar file chunks in the
 // background (in seconds)
 pref("app.update.download.backgroundInterval", 600);
--- a/mail/extensions/mailviews/content/mailViewList.js
+++ b/mail/extensions/mailviews/content/mailViewList.js
@@ -5,99 +5,91 @@
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var gMailListView;
 var gListBox;
 var gEditButton;
 var gDeleteButton;
 
-function mailViewListOnLoad()
-{
-  gMailListView = Cc["@mozilla.org/messenger/mailviewlist;1"].getService(Ci.nsIMsgMailViewList);;
-  gListBox = document.getElementById('mailViewList');
+function mailViewListOnLoad() {
+  gMailListView = Cc["@mozilla.org/messenger/mailviewlist;1"].getService(Ci.nsIMsgMailViewList);
+  gListBox = document.getElementById("mailViewList");
 
   // Construct list view based on current mail view list data
   refreshListView(null);
-  gEditButton = document.getElementById('editButton');
-  gDeleteButton = document.getElementById('deleteButton');
+  gEditButton = document.getElementById("editButton");
+  gDeleteButton = document.getElementById("deleteButton");
 
   updateButtons();
 }
 
-function refreshListView(aSelectedMailView)
-{
+function refreshListView(aSelectedMailView) {
   // remove any existing items in the view...
   for (var index = gListBox.getRowCount(); index > 0; index--)
     gListBox.getItemAtIndex(index - 1).remove();
 
   var numItems = gMailListView.mailViewCount;
   var mailView;
-  for (index = 0; index < numItems; index++)
-  {
+  for (index = 0; index < numItems; index++) {
     mailView = gMailListView.getMailViewAt(index);
     gListBox.appendItem(mailView.prettyName, index);
-    if (aSelectedMailView && (mailView.prettyName == aSelectedMailView.prettyName) )
+    if (aSelectedMailView && (mailView.prettyName == aSelectedMailView.prettyName))
       gListBox.selectedIndex = index;
   }
 }
 
-function onNewMailView()
-{
-   window.openDialog('chrome://messenger/content/mailViewSetup.xul', "", 'centerscreen,resizable,modal,titlebar,chrome', {onOkCallback: refreshListView});
+function onNewMailView() {
+   window.openDialog("chrome://messenger/content/mailViewSetup.xul",
+                     "", "centerscreen,resizable,modal,titlebar,chrome",
+                     { onOkCallback: refreshListView });
 }
 
-function onDeleteMailView()
-{
+function onDeleteMailView() {
   var bundle = Services.strings.createBundle("chrome://messenger/locale/messenger.properties");
 
   if (!Services.prompt.confirm(window, bundle.GetStringFromName("confirmViewDeleteTitle"), bundle.GetStringFromName("confirmViewDeleteMessage")))
     return;
 
   // get the selected index
   var selectedIndex = gListBox.selectedIndex;
-  if (selectedIndex >= 0)
-  {
+  if (selectedIndex >= 0) {
     var mailView = gMailListView.getMailViewAt(selectedIndex);
-    if (mailView)
-    {
+    if (mailView) {
       gMailListView.removeMailView(mailView);
       // now remove it from the view...
       gListBox.selectedItem.remove();
 
       // select the next item in the list..
       if (selectedIndex < gListBox.getRowCount())
         gListBox.selectedIndex = selectedIndex;
       else
         gListBox.selectedIndex = gListBox.getRowCount() - 1;
 
       gMailListView.save();
     }
   }
 }
 
-function onEditMailView()
-{
+function onEditMailView() {
   // get the selected index
   var selectedIndex = gListBox.selectedIndex;
-  if (selectedIndex >= 0)
-  {
+  if (selectedIndex >= 0) {
     var selMailView = gMailListView.getMailViewAt(selectedIndex);
     // open up the mail view setup dialog passing in the mail view as an argument....
 
     var args = {mailView: selMailView, onOkCallback: refreshListView};
 
-    window.openDialog('chrome://messenger/content/mailViewSetup.xul', "", 'centerscreen,modal,resizable,titlebar,chrome', args);
+    window.openDialog("chrome://messenger/content/mailViewSetup.xul",
+                      "", "centerscreen,modal,resizable,titlebar,chrome", args);
   }
 }
 
-function onMailViewSelect(event)
-{
+function onMailViewSelect(event) {
   updateButtons();
 }
 
-function updateButtons()
-{
+function updateButtons() {
   var selectedIndex = gListBox.selectedIndex;
   // "edit" and "delete" only enabled when one filter selected
   gEditButton.disabled = selectedIndex < 0;
   gDeleteButton.disabled = selectedIndex < 0;
 }
--- a/mail/extensions/mailviews/content/mailViewSetup.js
+++ b/mail/extensions/mailviews/content/mailViewSetup.js
@@ -1,70 +1,62 @@
 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-var nsMsgSearchScope = Ci.nsMsgSearchScope;
+/* import-globals-from ../../../../mailnews/base/search/content/searchTermOverlay.js */
+
 var gMailView = null;
 
 var dialog;
 
-function mailViewOnLoad()
-{
+function mailViewOnLoad() {
   initializeSearchWidgets();
   initializeMailViewOverrides();
   dialog = {};
 
-  if ("arguments" in window && window.arguments[0])
-  {
+  if ("arguments" in window && window.arguments[0]) {
     var args = window.arguments[0];
     if ("mailView" in args)
       gMailView = window.arguments[0].mailView;
     if ("onOkCallback" in args)
       dialog.okCallback =  window.arguments[0].onOkCallback;
   }
 
   dialog.OKButton = document.documentElement.getButton("accept");
   dialog.nameField = document.getElementById("name");
   dialog.nameField.focus();
 
-  setSearchScope(nsMsgSearchScope.offlineMail);
+  setSearchScope(Ci.nsMsgSearchScope.offlineMail);
 
-  if (gMailView)
-  {
+  if (gMailView) {
     dialog.nameField.value = gMailView.prettyName;
-    initializeSearchRows(nsMsgSearchScope.offlineMail, gMailView.searchTerms);
+    initializeSearchRows(Ci.nsMsgSearchScope.offlineMail, gMailView.searchTerms);
+  } else {
+    onMore(null);
   }
-  else
-    onMore(null);
 
   doEnabling();
 }
 
-function mailViewOnUnLoad()
-{
-
+function mailViewOnUnLoad() {
 }
 
-function onOK()
-{
+function onOK() {
   var mailViewList = Cc["@mozilla.org/messenger/mailviewlist;1"].getService(Ci.nsIMsgMailViewList);
 
   // reflect the search widgets back into the search session
   var newMailView = null;
-  if (gMailView)
-  {
+  if (gMailView) {
     saveSearchTerms(gMailView.searchTerms, gMailView);
     // if the name of the view has been changed...
     if (gMailView.prettyName != dialog.nameField.value)
       gMailView.mailViewName = dialog.nameField.value;
-  }
-  else
-  {
+  } else {
     // otherwise, create a new mail view
     newMailView = mailViewList.createMailView();
 
     saveSearchTerms(newMailView.searchTerms, newMailView);
     newMailView.mailViewName = dialog.nameField.value;
     // now add the mail view to our mail view list
     mailViewList.addMailView(newMailView);
   }
@@ -72,48 +64,35 @@ function onOK()
   mailViewList.save();
 
   if (dialog.okCallback)
     dialog.okCallback(gMailView ? gMailView : newMailView);
 
   return true;
 }
 
-function initializeMailViewOverrides()
-{
+function initializeMailViewOverrides() {
   // replace some text with something we want. Need to add some ids to searchOverlay.js
-  //var orButton = document.getElementById('or');
-  //orButton.setAttribute('label', 'Any of the following');
-  //var andButton = document.getElementById('and');
-  //andButton.setAttribute('label', 'All of the following');
+  // var orButton = document.getElementById('or');
+  // orButton.setAttribute('label', 'Any of the following');
+  // var andButton = document.getElementById('and');
+  // andButton.setAttribute('label', 'All of the following');
   // matchAll doesn't make sense for views, since views are a single folder
   hideMatchAllItem();
 
 }
 
-function UpdateAfterCustomHeaderChange()
-{
+function UpdateAfterCustomHeaderChange() {
   updateSearchAttributes();
 }
 
-function doEnabling()
-{
-  if (dialog.nameField.value)
-  {
+function doEnabling() {
+  if (dialog.nameField.value) {
     if (dialog.OKButton.disabled)
       dialog.OKButton.disabled = false;
-  } else
-  {
-    if (!dialog.OKButton.disabled)
-      dialog.OKButton.disabled = true;
+  } else if (!dialog.OKButton.disabled) {
+    dialog.OKButton.disabled = true;
   }
 }
 
-function onEnterInSearchTerm()
-{
+function onEnterInSearchTerm() {
   // no-op for us...
 }
-
-function doHelpButton()
-{
-  openHelp("message-views-create-new");
-}
-
--- a/mail/extensions/mailviews/content/msgViewPickerOverlay.js
+++ b/mail/extensions/mailviews/content/msgViewPickerOverlay.js
@@ -1,14 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* import-globals-from ../../../base/content/commandglue.js */
+
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailViewManager.jsm");
+var {
+  MailViewConstants,
+} = ChromeUtils.import("resource:///modules/MailViewManager.jsm", null);
 
 // these constants are now authoritatively defined in MailViewManager.jsm (above)
 // tag views have kViewTagMarker + their key as value
 var kViewItemAll         = MailViewConstants.kViewItemAll;
 var kViewItemUnread      = MailViewConstants.kViewItemUnread;
 var kViewItemTags        = MailViewConstants.kViewItemTags; // former labels used values 2-6
 var kViewItemNotDeleted  = MailViewConstants.kViewItemNotDeleted;
 // not a real view! a sentinel value to pop up a dialog
@@ -21,68 +25,56 @@ var kViewCurrent    = MailViewConstants.
 var kViewCurrentTag = MailViewConstants.kViewCurrentTag;
 var kViewTagMarker  = MailViewConstants.kViewTagMarker;
 
 /**
  * A reference to the nsIMsgMailViewList service that tracks custom mail views.
  */
 var gMailViewList = null;
 
-var nsMsgSearchScope  = Ci.nsMsgSearchScope;
-var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
-var nsMsgSearchOp     = Ci.nsMsgSearchOp;
-
-var nsMsgMessageFlags = Ci.nsMsgMessageFlags;
-
 // perform the view/action requested by the aValue string
 // and set the view picker label to the aLabel string
-function ViewChange(aValue)
-{
-  if (aValue == kViewItemCustomize || aValue == kViewItemVirtual)
-  {
+function ViewChange(aValue) {
+  if (aValue == kViewItemCustomize || aValue == kViewItemVirtual) {
     // restore to the previous view value, in case they cancel
     ViewPickerBinding.updateDisplay();
     if (aValue == kViewItemCustomize)
       LaunchCustomizeDialog();
     else
       gFolderTreeController.newVirtualFolder(
         ViewPickerBinding.currentViewLabel,
         gFolderDisplay.view.search.viewTerms);
     return;
   }
 
   // tag menuitem values are of the form :<keyword>
-  if (isNaN(aValue))
-  {
+  if (isNaN(aValue)) {
     // split off the tag key
     var tagkey = aValue.substr(kViewTagMarker.length);
     gFolderDisplay.view.setMailView(kViewItemTags, tagkey);
-  }
-  else
-  {
+  } else {
     var numval = Number(aValue);
     gFolderDisplay.view.setMailView(numval, null);
   }
   ViewPickerBinding.updateDisplay();
 }
 
 
-function ViewChangeByMenuitem(aMenuitem)
-{
+function ViewChangeByMenuitem(aMenuitem) {
   // Mac View menu menuitems don't have XBL bindings
   ViewChange(aMenuitem.getAttribute("value"));
 }
 
 /**
  * Mediates interaction with the #viewPickerPopup.  In theory this should be
  *  an XBL binding, but for the insanity where the view picker may not be
  *  visible at all times (or ever).  No view picker widget, no binding.
  */
 var ViewPickerBinding = {
-  _init: function ViewPickerBinding_init() {
+  _init() {
     window.addEventListener(
       "MailViewChanged",
       function(aEvent) { ViewPickerBinding.updateDisplay(aEvent); });
   },
 
   /**
    * Return true if the view picker is visible.  This is used by the
    *  FolderDisplayWidget to know whether or not to actually use mailviews. (The
@@ -97,78 +89,72 @@ var ViewPickerBinding = {
   /**
    * Return the string value representing the current mail view value as
    *  understood by the view picker widgets.  The value is the index for
    *  everything but tags.  for tags it's the ":"-prefixed tagname.
    */
   get currentViewValue() {
     if (gFolderDisplay.view.mailViewIndex == kViewItemTags)
       return kViewTagMarker + gFolderDisplay.view.mailViewData;
-    else
-      return gFolderDisplay.view.mailViewIndex + "";
+    return gFolderDisplay.view.mailViewIndex + "";
   },
 
   /**
    * @return The label for the current mail view value.
    */
   get currentViewLabel() {
     let viewPicker = document.getElementById("viewPicker");
     return viewPicker.getAttribute("label");
   },
 
   /**
    * The effective view has changed, update the widget.
    */
-  updateDisplay: function ViewPickerBinding_updateDisplay(aEvent, aGiveUpIfNotFound) {
+  updateDisplay(aEvent, aGiveUpIfNotFound) {
     let viewPicker = document.getElementById("viewPicker");
     if (viewPicker) {
       let value = this.currentViewValue;
 
       let viewPickerPopup = document.getElementById("viewPickerPopup");
       let selectedItem =
         viewPickerPopup.querySelector('[value="' + value + '"]');
-      if (!selectedItem)
-      {
+      if (!selectedItem) {
         // we may have a new item, so refresh to make it show up
         RefreshAllViewPopups(viewPickerPopup, true);
         selectedItem = viewPickerPopup.querySelector('[value="' + value + '"]');
       }
       viewPicker.setAttribute("label",
                               selectedItem && selectedItem.getAttribute("label"));
     }
   },
 };
 ViewPickerBinding._init();
 
-function LaunchCustomizeDialog()
-{
+function LaunchCustomizeDialog() {
   OpenOrFocusWindow({}, "mailnews:mailviewlist", "chrome://messenger/content/mailViewList.xul");
 }
 
 /**
  * All of these Refresh*ViewPopup* methods have to deal with two menu
  *  variations.  They are accessible from the "View... Messages" menu as well as
  *  the view picker menu list in the toolbar.  aIsMenulist will be false in the
  *  former case and true in the latter case.
  */
-function RefreshAllViewPopups(aViewPopup)
-{
+function RefreshAllViewPopups(aViewPopup) {
   RefreshViewPopup(aViewPopup);
   var menupopups = aViewPopup.getElementsByTagName("menupopup");
-  if (menupopups.length > 1)
-  {
+  if (menupopups.length > 1) {
     // when we have menupopups, we assume both tags and custom views are there
     RefreshTagsPopup(menupopups[0]);
     RefreshCustomViewsPopup(menupopups[1]);
   }
 }
 
 
-function RefreshViewPopup(aViewPopup)
-{
+function RefreshViewPopup(aViewPopup) {
   // mark default views if selected
   let currentViewValue = ViewPickerBinding.currentViewValue;
 
   let viewAll = aViewPopup.querySelector('[value="' + kViewItemAll + '"]');
   viewAll.setAttribute("checked", currentViewValue == kViewItemAll);
   let viewUnread =
     aViewPopup.querySelector('[value="' + kViewItemUnread + '"]');
   viewUnread.setAttribute("checked", currentViewValue == kViewItemUnread);
@@ -179,83 +165,77 @@ function RefreshViewPopup(aViewPopup)
   if (folderArray.length == 0)
     return;
 
   // only show the "Not Deleted" item for IMAP servers that are using the IMAP
   // delete model
   viewNotDeleted.setAttribute("hidden", true);
   var msgFolder = folderArray[0];
   var server = msgFolder.server;
-  if (server.type == "imap")
-  {
+  if (server.type == "imap") {
     let imapServer =
       server.QueryInterface(Ci.nsIImapIncomingServer);
     if (imapServer.deleteModel == Ci.nsMsgImapDeleteModels.IMAPDelete) {
       viewNotDeleted.setAttribute("hidden", false);
       viewNotDeleted.setAttribute("checked",
                                   currentViewValue == kViewItemNotDeleted);
     }
   }
 }
 
 
-function RefreshCustomViewsPopup(aMenupopup)
-{
+function RefreshCustomViewsPopup(aMenupopup) {
   // for each mail view in the msg view list, add an entry in our combo box
   if (!gMailViewList)
     gMailViewList = Cc["@mozilla.org/messenger/mailviewlist;1"]
                       .getService(Ci.nsIMsgMailViewList);
   // remove all menuitems
   while (aMenupopup.hasChildNodes())
     aMenupopup.lastChild.remove();
 
   // now rebuild the list
   var currentView = ViewPickerBinding.currentViewValue;
   var numItems = gMailViewList.mailViewCount;
-  for (var i = 0; i < numItems; ++i)
-  {
+  for (var i = 0; i < numItems; ++i) {
     var viewInfo = gMailViewList.getMailViewAt(i);
     var menuitem = document.createElement("menuitem");
     menuitem.setAttribute("label", viewInfo.prettyName);
     menuitem.setAttribute("value", kViewItemFirstCustom + i);
     menuitem.setAttribute("type", "radio");
     if (kViewItemFirstCustom + i == currentView)
       menuitem.setAttribute("checked", true);
     aMenupopup.appendChild(menuitem);
   }
 }
 
 
-function RefreshTagsPopup(aMenupopup)
-{
+function RefreshTagsPopup(aMenupopup) {
   // remove all menuitems
   while (aMenupopup.hasChildNodes())
     aMenupopup.lastChild.remove();
 
   // create tag menuitems
   let currentTagKey = gFolderDisplay.view.mailViewIndex == kViewItemTags ?
                         gFolderDisplay.view.mailViewData : "";
   let tagArray = MailServices.tags.getAllTags({});
-  for (let i = 0; i < tagArray.length; ++i)
-  {
+  for (let i = 0; i < tagArray.length; ++i) {
     let tagInfo = tagArray[i];
     let menuitem = document.createElement("menuitem");
     menuitem.setAttribute("label", tagInfo.tag);
     menuitem.setAttribute("value", kViewTagMarker + tagInfo.key);
     menuitem.setAttribute("type", "radio");
     if (tagInfo.key == currentTagKey)
       menuitem.setAttribute("checked", true);
     let color = tagInfo.color;
     if (color)
       menuitem.setAttribute("class", "lc-" + color.substr(1));
     aMenupopup.appendChild(menuitem);
   }
 }
 
-function ViewPickerOnLoad()
-{
+function ViewPickerOnLoad() {
   var viewPickerPopup = document.getElementById("viewPickerPopup");
   if (viewPickerPopup)
     RefreshAllViewPopups(viewPickerPopup, true);
 }
 
 
 window.addEventListener("load", ViewPickerOnLoad);
--- a/mail/extensions/smime/content/msgCompSMIMEOverlay.js
+++ b/mail/extensions/smime/content/msgCompSMIMEOverlay.js
@@ -1,13 +1,16 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* import-globals-from ../../../../mailnews/base/prefs/content/accountUtils.js */
+/* import-globals-from ../../../components/compose/content/MsgComposeCommands.js */
+
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 // Account encryption policy values:
 // const kEncryptionPolicy_Never = 0;
 // 'IfPossible' was used by ns4.
 // const kEncryptionPolicy_IfPossible = 1;
 var kEncryptionPolicy_Always = 2;
@@ -17,18 +20,17 @@ var gEncryptedURIService =
           .getService(Ci.nsIEncryptedSMIMEURIsService);
 
 var gNextSecurityButtonCommand = "";
 var gSMFields = null;
 
 var gEncryptOptionChanged;
 var gSignOptionChanged;
 
-function onComposerLoad()
-{
+function onComposerLoad() {
   // Are we already set up ? Or are the required fields missing ?
   if (gSMFields || !gMsgCompose || !gMsgCompose.compFields)
     return;
 
   gMsgCompose.compFields.composeSecure = null;
 
   gSMFields = Cc["@mozilla.org/messengercompose/composesecure;1"]
                 .createInstance(Ci.nsIMsgComposeSecure);
@@ -37,18 +39,17 @@ function onComposerLoad()
 
   gMsgCompose.compFields.composeSecure = gSMFields;
 
   // Set up the initial security state.
   gSMFields.requireEncryptMessage =
     gCurrentIdentity.getIntAttribute("encryptionpolicy") == kEncryptionPolicy_Always;
   if (!gSMFields.requireEncryptMessage &&
       gEncryptedURIService &&
-      gEncryptedURIService.isEncrypted(gMsgCompose.originalMsgURI))
-  {
+      gEncryptedURIService.isEncrypted(gMsgCompose.originalMsgURI)) {
     // Override encryption setting if original is known as encrypted.
     gSMFields.requireEncryptMessage = true;
   }
   if (gSMFields.requireEncryptMessage)
     setEncryptionUI();
   else
     setNoEncryptionUI();
 
@@ -57,317 +58,269 @@ function onComposerLoad()
     setSignatureUI();
   else
     setNoSignatureUI();
 }
 
 addEventListener("load", smimeComposeOnLoad, {capture: false, once: true});
 
 // this function gets called multiple times.
-function smimeComposeOnLoad()
-{
+function smimeComposeOnLoad() {
   onComposerLoad();
 
   top.controllers.appendController(SecurityController);
 
   addEventListener("compose-from-changed", onComposerFromChanged, true);
   addEventListener("compose-send-message", onComposerSendMessage, true);
 
   addEventListener("unload", smimeComposeOnUnload, {capture: false, once: true});
 }
 
-function smimeComposeOnUnload()
-{
+function smimeComposeOnUnload() {
   removeEventListener("compose-from-changed", onComposerFromChanged, true);
   removeEventListener("compose-send-message", onComposerSendMessage, true);
 
   top.controllers.removeController(SecurityController);
 }
 
-function GetServer()
-{
+function GetServer() {
   let servers = MailServices.accounts.getServersForIdentity(gCurrentIdentity);
   return servers.queryElementAt(0, Ci.nsIMsgIncomingServer);
 }
 
-function showNeedSetupInfo()
-{
+function showNeedSetupInfo() {
   let compSmimeBundle = document.getElementById("bundle_comp_smime");
   let brandBundle = document.getElementById("brandBundle");
   if (!compSmimeBundle || !brandBundle)
     return;
 
   let buttonPressed =
     Services.prompt.confirmEx(window,
                               brandBundle.getString("brandShortName"),
                               compSmimeBundle.getString("NeedSetup"),
                               Services.prompt.STD_YES_NO_BUTTONS, 0, 0, 0, null, {});
   if (buttonPressed == 0)
     MsgAccountManager("am-smime.xul", GetServer());
 }
 
-function toggleEncryptMessage()
-{
+function toggleEncryptMessage() {
   if (!gSMFields)
     return;
 
   gSMFields.requireEncryptMessage = !gSMFields.requireEncryptMessage;
 
-  if (gSMFields.requireEncryptMessage)
-  {
+  if (gSMFields.requireEncryptMessage) {
     // Make sure we have a cert.
-    if (!gCurrentIdentity.getUnicharAttribute("encryption_cert_name"))
-    {
+    if (!gCurrentIdentity.getUnicharAttribute("encryption_cert_name")) {
       gSMFields.requireEncryptMessage = false;
       showNeedSetupInfo();
       return;
     }
 
     setEncryptionUI();
-  }
-  else
-  {
+  } else {
     setNoEncryptionUI();
   }
 
   gEncryptOptionChanged = true;
 }
 
-function toggleSignMessage()
-{
+function toggleSignMessage() {
   if (!gSMFields)
     return;
 
   gSMFields.signMessage = !gSMFields.signMessage;
 
-  if (gSMFields.signMessage) // make sure we have a cert name...
-  {
-    if (!gCurrentIdentity.getUnicharAttribute("signing_cert_name"))
-    {
+  if (gSMFields.signMessage) { // make sure we have a cert name...
+    if (!gCurrentIdentity.getUnicharAttribute("signing_cert_name")) {
       gSMFields.signMessage = false;
       showNeedSetupInfo();
       return;
     }
 
     setSignatureUI();
-  }
-  else
-  {
+  } else {
     setNoSignatureUI();
   }
 
   gSignOptionChanged = true;
 }
 
-function setSecuritySettings(menu_id)
-{
+function setSecuritySettings(menu_id) {
   if (!gSMFields)
     return;
 
   document.getElementById("menu_securityEncryptRequire" + menu_id)
           .setAttribute("checked", gSMFields.requireEncryptMessage);
   document.getElementById("menu_securitySign" + menu_id)
           .setAttribute("checked", gSMFields.signMessage);
 }
 
-function setNextCommand(what)
-{
+function setNextCommand(what) {
   gNextSecurityButtonCommand = what;
 }
 
-function doSecurityButton()
-{
+function doSecurityButton() {
   var what = gNextSecurityButtonCommand;
   gNextSecurityButtonCommand = "";
 
-  switch (what)
-  {
+  switch (what) {
     case "encryptMessage":
       toggleEncryptMessage();
       break;
 
     case "signMessage":
       toggleSignMessage();
       break;
 
     case "show":
     default:
       showMessageComposeSecurityStatus();
   }
 }
 
-function setNoSignatureUI()
-{
+function setNoSignatureUI() {
   top.document.getElementById("signing-status").classList.remove("signing-msg");
 }
 
-function setSignatureUI()
-{
+function setSignatureUI() {
   top.document.getElementById("signing-status").classList.add("signing-msg");
 }
 
-function setNoEncryptionUI()
-{
+function setNoEncryptionUI() {
   top.document.getElementById("encryption-status").classList.remove("encrypting-msg");
 }
 
-function setEncryptionUI()
-{
+function setEncryptionUI() {
   top.document.getElementById("encryption-status").classList.add("encrypting-msg");
 }
 
-function showMessageComposeSecurityStatus()
-{
+function showMessageComposeSecurityStatus() {
   Recipients2CompFields(gMsgCompose.compFields);
 
   window.openDialog(
     "chrome://messenger-smime/content/msgCompSecurityInfo.xul",
     "",
     "chrome,modal,resizable,centerscreen",
     {
-      compFields : gMsgCompose.compFields,
-      subject : GetMsgSubjectElement().value,
-      smFields : gSMFields,
-      isSigningCertAvailable :
+      compFields: gMsgCompose.compFields,
+      subject: GetMsgSubjectElement().value,
+      smFields: gSMFields,
+      isSigningCertAvailable:
         gCurrentIdentity.getUnicharAttribute("signing_cert_name") != "",
-      isEncryptionCertAvailable :
+      isEncryptionCertAvailable:
         gCurrentIdentity.getUnicharAttribute("encryption_cert_name") != "",
-      currentIdentity : gCurrentIdentity
+      currentIdentity: gCurrentIdentity,
     }
   );
 }
 
-var SecurityController =
-{
-  supportsCommand: function(command)
-  {
-    switch (command)
-    {
+var SecurityController = {
+  supportsCommand(command) {
+    switch (command) {
       case "cmd_viewSecurityStatus":
         return true;
 
       default:
         return false;
     }
   },
 
-  isCommandEnabled: function(command)
-  {
-    switch (command)
-    {
+  isCommandEnabled(command) {
+    switch (command) {
       case "cmd_viewSecurityStatus":
         return true;
 
       default:
         return false;
     }
-  }
+  },
 };
 
-function onComposerSendMessage()
-{
-  let missingCount = new Object();
-  let emailAddresses = new Object();
+function onComposerSendMessage() {
+  let missingCount = {};
+  let emailAddresses = {};
 
-  try
-  {
+  try {
     if (!gMsgCompose.compFields.composeSecure.requireEncryptMessage)
       return;
 
     Cc["@mozilla.org/messenger-smime/smimejshelper;1"]
       .createInstance(Ci.nsISMimeJSHelper)
       .getNoCertAddresses(gMsgCompose.compFields,
                                   missingCount,
                                   emailAddresses);
-  }
-  catch (e)
-  {
+  } catch (e) {
     return;
   }
 
-  if (missingCount.value > 0)
-  {
+  if (missingCount.value > 0) {
     // The rules here: If the current identity has a directoryServer set, then
     // use that, otherwise, try the global preference instead.
 
     let autocompleteDirectory;
 
     // Does the current identity override the global preference?
-    if (gCurrentIdentity.overrideGlobalPref)
-    {
+    if (gCurrentIdentity.overrideGlobalPref) {
       autocompleteDirectory = gCurrentIdentity.directoryServer;
-    }
-    else
-    {
+    } else if (Services.prefs.getBoolPref("ldap_2.autoComplete.useDirectory")) {
       // Try the global one
-      if (Services.prefs.getBoolPref("ldap_2.autoComplete.useDirectory"))
-        autocompleteDirectory =
-          Services.prefs.getCharPref("ldap_2.autoComplete.directoryServer");
+      autocompleteDirectory =
+        Services.prefs.getCharPref("ldap_2.autoComplete.directoryServer");
     }
 
     if (autocompleteDirectory)
       window.openDialog("chrome://messenger-smime/content/certFetchingStatus.xul",
                         "",
                         "chrome,modal,resizable,centerscreen",
                         autocompleteDirectory,
                         emailAddresses.value);
   }
 }
 
-function onComposerFromChanged()
-{
+function onComposerFromChanged() {
   if (!gSMFields)
     return;
 
   var encryptionPolicy = gCurrentIdentity.getIntAttribute("encryptionpolicy");
   var useEncryption = false;
-  if (!gEncryptOptionChanged)
-  {
+  if (!gEncryptOptionChanged) {
     // Encryption wasn't manually checked.
     // Set up the encryption policy from the setting of the new identity.
 
     useEncryption = (encryptionPolicy == kEncryptionPolicy_Always);
-  }
-  else
-  {
+  } else if (encryptionPolicy != kEncryptionPolicy_Always) {
     // The encryption policy was manually checked. That means we can get into
     // the situation that the new identity doesn't have a cert to encrypt with.
     // If it doesn't, don't encrypt.
 
-    if (encryptionPolicy != kEncryptionPolicy_Always) // Encrypted (policy unencrypted, manually changed).
-    {
-      // Make sure we have a cert for encryption.
-      useEncryption = !!gCurrentIdentity.getUnicharAttribute("encryption_cert_name");
-    }
+    // Encrypted (policy unencrypted, manually changed).
+    // Make sure we have a cert for encryption.
+    useEncryption = !!gCurrentIdentity.getUnicharAttribute("encryption_cert_name");
   }
   gSMFields.requireEncryptMessage = useEncryption;
   if (useEncryption)
     setEncryptionUI();
   else
     setNoEncryptionUI();
 
   var signMessage = gCurrentIdentity.getBoolAttribute("sign_mail");
   var useSigning = false;
-  if (!gSignOptionChanged)
-  {
+  if (!gSignOptionChanged) {
     // Signing wasn't manually checked.
     // Set up the signing policy from the setting of the new identity.
 
     useSigning = signMessage;
-  }
-  else
-  {
+  } else if (!signMessage) {
     // The signing policy was manually checked. That means we can get into
     // the situation that the new identity doesn't have a cert to sign with.
     // If it doesn't, don't sign.
 
-    if (!signMessage) // Signed (policy unsigned, manually changed).
-    {
-      // Make sure we have a cert for signing.
-      useSigning = !!gCurrentIdentity.getUnicharAttribute("signing_cert_name");
-    }
+    // Signed (policy unsigned, manually changed).
+    // Make sure we have a cert for signing.
+    useSigning = !!gCurrentIdentity.getUnicharAttribute("signing_cert_name");
   }
   gSMFields.signMessage = useSigning;
   if (useSigning)
     setSignatureUI();
   else
     setNoSignatureUI();
 }
--- a/mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js
+++ b/mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js
@@ -1,72 +1,68 @@
 /* -*- Mode: JavaScript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* import-globals-from ../../../../mailnews/extensions/smime/content/msgReadSMIMEOverlay.js */
+/* import-globals-from ../../../base/content/folderDisplay.js */
+/* import-globals-from ../../../base/content/msgHdrView.js */
+
 var gSignedUINode = null;
 var gEncryptedUINode = null;
 var gSMIMEContainer = null;
 var gStatusBar = null;
 
 var gEncryptedURIService = null;
 var gMyLastEncryptedURI = null;
 
 var gSMIMEBundle = null;
 
-// manipulates some globals from msgReadSMIMEOverlay.js
-
-var nsICMSMessageErrors = Ci.nsICMSMessageErrors;
-
-/// Get the necko URL for the message URI.
-function neckoURLForMessageURI(aMessageURI)
-{
+// Get the necko URL for the message URI.
+function neckoURLForMessageURI(aMessageURI) {
   let msgSvc = Cc["@mozilla.org/messenger;1"]
     .createInstance(Ci.nsIMessenger)
     .messageServiceFromURI(aMessageURI);
   let neckoURI = {};
   msgSvc.GetUrlForUri(aMessageURI, neckoURI, null);
   return neckoURI.value.spec;
 }
 
-var smimeHeaderSink =
-{
-  maxWantedNesting: function()
-  {
+var smimeHeaderSink = {
+  maxWantedNesting() {
     return 1;
   },
 
-  signedStatus: function(aNestingLevel, aSignatureStatus, aSignerCert)
-  {
+  signedStatus(aNestingLevel, aSignatureStatus, aSignerCert) {
     if (aNestingLevel > 1) {
       // we are not interested
       return;
     }
 
     gSignatureStatus = aSignatureStatus;
     gSignerCert = aSignerCert;
 
     gSMIMEContainer.collapsed = false;
     gSignedUINode.collapsed = false;
 
     switch (aSignatureStatus) {
-      case nsICMSMessageErrors.SUCCESS:
+      case Ci.nsICMSMessageErrors.SUCCESS:
         gSignedUINode.setAttribute("signed", "ok");
         gStatusBar.setAttribute("signed", "ok");
         break;
 
-      case nsICMSMessageErrors.VERIFY_NOT_YET_ATTEMPTED:
+      case Ci.nsICMSMessageErrors.VERIFY_NOT_YET_ATTEMPTED:
         gSignedUINode.setAttribute("signed", "unknown");
         gStatusBar.setAttribute("signed", "unknown");
         this.showSenderIfSigner();
         break;
 
-      case nsICMSMessageErrors.VERIFY_CERT_WITHOUT_ADDRESS:
-      case nsICMSMessageErrors.VERIFY_HEADER_MISMATCH:
+      case Ci.nsICMSMessageErrors.VERIFY_CERT_WITHOUT_ADDRESS:
+      case Ci.nsICMSMessageErrors.VERIFY_HEADER_MISMATCH:
         gSignedUINode.setAttribute("signed", "mismatch");
         gStatusBar.setAttribute("signed", "mismatch");
         this.showSenderIfSigner();
         break;
 
       default:
         gSignedUINode.setAttribute("signed", "notok");
         gStatusBar.setAttribute("signed", "notok");
@@ -75,17 +71,17 @@ var smimeHeaderSink =
   },
 
   /**
    * Force showing Sender if we have a Sender and it's not signed by From.
    * For a valid cert that means the Sender signed it - and the signed mismatch
    * mark is shown. To understand why it's not a confirmed signing it's useful
    * to have the Sender header showing.
    */
-  showSenderIfSigner: function() {
+  showSenderIfSigner() {
     if (!("sender" in currentHeaderData))
       return; // Sender not set, or same as From (so no longer present).
 
     if (Services.prefs.getBoolPref("mailnews.headers.showSender"))
       return; // Sender header will be show due to pref - nothing more to do.
 
     let fromMailboxes = MailServices.headerParser.extractHeaderAddressMailboxes(
             currentHeaderData.from.headerValue).split(",");
@@ -97,91 +93,82 @@ var smimeHeaderSink =
 
     let senderInfo = { name: "sender", outputFunction: OutputEmailAddresses };
     let senderEntry = new createHeaderEntry("expanded", senderInfo);
 
     gExpandedHeaderView[senderInfo.name] = senderEntry;
     UpdateExpandedMessageHeaders();
   },
 
-  encryptionStatus: function(aNestingLevel, aEncryptionStatus, aRecipientCert)
-  {
+  encryptionStatus(aNestingLevel, aEncryptionStatus, aRecipientCert) {
     if (aNestingLevel > 1) {
       // we are not interested
       return;
     }
 
     gEncryptionStatus = aEncryptionStatus;
     gEncryptionCert = aRecipientCert;
 
     gSMIMEContainer.collapsed = false;
     gEncryptedUINode.collapsed = false;
 
-    if (nsICMSMessageErrors.SUCCESS == aEncryptionStatus)
-    {
+    if (Ci.nsICMSMessageErrors.SUCCESS == aEncryptionStatus) {
       gEncryptedUINode.setAttribute("encrypted", "ok");
       gStatusBar.setAttribute("encrypted", "ok");
-    }
-    else
-    {
+    } else {
       gEncryptedUINode.setAttribute("encrypted", "notok");
       gStatusBar.setAttribute("encrypted", "notok");
     }
 
-    if (gEncryptedURIService)
-    {
+    if (gEncryptedURIService) {
       // Remember the message URI and the corresponding necko URI.
       gMyLastEncryptedURI = gFolderDisplay.selectedMessageUris[0];
       gEncryptedURIService.rememberEncrypted(gMyLastEncryptedURI);
       gEncryptedURIService.rememberEncrypted(
         neckoURLForMessageURI(gMyLastEncryptedURI));
     }
 
-    switch (aEncryptionStatus)
-    {
-    case nsICMSMessageErrors.SUCCESS:
-    case nsICMSMessageErrors.ENCRYPT_INCOMPLETE:
+    switch (aEncryptionStatus) {
+    case Ci.nsICMSMessageErrors.SUCCESS:
+    case Ci.nsICMSMessageErrors.ENCRYPT_INCOMPLETE:
       break;
     default:
       var brand = document.getElementById("bundle_brand")
                           .getString("brandShortName");
-      var title = gSMIMEBundle.getString("CantDecryptTitle").replace(/%brand%/g,brand);
-      var body = gSMIMEBundle.getString("CantDecryptBody").replace(/%brand%/g,brand);
+      var title = gSMIMEBundle.getString("CantDecryptTitle").replace(/%brand%/g, brand);
+      var body = gSMIMEBundle.getString("CantDecryptBody").replace(/%brand%/g, brand);
 
       // insert our message
       msgWindow.displayHTMLInMessagePane(title,
-       "<html>\n"+
-       "<body bgcolor=\"#fafaee\">\n"+
-       "<center><br><br><br>\n"+
-       "<table>\n"+
-       "<tr><td>\n"+
-       "<center><strong><font size=\"+3\">\n"+
-       title+"</font></center><br>\n"+
-       body+"\n"+
+       "<html>\n" +
+       "<body bgcolor=\"#fafaee\">\n" +
+       "<center><br><br><br>\n" +
+       "<table>\n" +
+       "<tr><td>\n" +
+       "<center><strong><font size=\"+3\">\n" +
+       title + "</font></center><br>\n" +
+       body + "\n" +
        "</td></tr></table></center></body></html>", false);
       break;
     }
   },
 
   QueryInterface: ChromeUtils.generateQI(["nsIMsgSMIMEHeaderSink"]),
 };
 
-function forgetEncryptedURI()
-{
-  if (gMyLastEncryptedURI && gEncryptedURIService)
-  {
+function forgetEncryptedURI() {
+  if (gMyLastEncryptedURI && gEncryptedURIService) {
     gEncryptedURIService.forgetEncrypted(gMyLastEncryptedURI);
     gEncryptedURIService.forgetEncrypted(
       neckoURLForMessageURI(gMyLastEncryptedURI));
     gMyLastEncryptedURI = null;
   }
 }
 
-function onSMIMEStartHeaders()
-{
+function onSMIMEStartHeaders() {
   gEncryptionStatus = -1;
   gSignatureStatus = -1;
 
   gSignerCert = null;
   gEncryptionCert = null;
 
   gSMIMEContainer.collapsed = true;
 
@@ -194,18 +181,17 @@ function onSMIMEStartHeaders()
   gStatusBar.removeAttribute("encrypted");
 
   forgetEncryptedURI();
 }
 
 function onSMIMEEndHeaders() {
 }
 
-function onSmartCardChange()
-{
+function onSmartCardChange() {
   // only reload encrypted windows
   if (gMyLastEncryptedURI && gEncryptionStatus != -1) {
     ReloadMessage();
   }
 }
 
 function onSMIMEBeforeShowHeaderPane() {
   // For signed messages with differing Sender as signer we force showing Sender.
@@ -213,79 +199,72 @@ function onSMIMEBeforeShowHeaderPane() {
   // it from the header view, so that Sender normally isn't shown.
   if ("sender" in gExpandedHeaderView &&
       !Services.prefs.getBoolPref("mailnews.headers.showSender")) {
     gExpandedHeaderView.sender.enclosingRow.collapsed = true;
     delete gExpandedHeaderView.sender;
   }
 }
 
-function msgHdrViewSMIMEOnLoad(event)
-{
+function msgHdrViewSMIMEOnLoad(event) {
   window.crypto.enableSmartCardEvents = true;
   document.addEventListener("smartcard-insert", onSmartCardChange);
   document.addEventListener("smartcard-remove", onSmartCardChange);
   if (!gSMIMEBundle)
     gSMIMEBundle = document.getElementById("bundle_read_smime");
 
   // we want to register our security header sink as an opaque nsISupports
   // on the msgHdrSink used by mail.....
   msgWindow.msgHeaderSink.securityInfo = smimeHeaderSink;
 
-  gSignedUINode = document.getElementById('signedHdrIcon');
-  gEncryptedUINode = document.getElementById('encryptedHdrIcon');
-  gSMIMEContainer = document.getElementById('smimeBox');
-  gStatusBar = document.getElementById('status-bar');
+  gSignedUINode = document.getElementById("signedHdrIcon");
+  gEncryptedUINode = document.getElementById("encryptedHdrIcon");
+  gSMIMEContainer = document.getElementById("smimeBox");
+  gStatusBar = document.getElementById("status-bar");
 
   // Add ourself to the list of message display listeners so we get notified
   // when we are about to display a message.
   var listener = {};
   listener.onStartHeaders = onSMIMEStartHeaders;
   listener.onEndHeaders = onSMIMEEndHeaders;
   listener.onBeforeShowHeaderPane = onSMIMEBeforeShowHeaderPane;
   gMessageListeners.push(listener);
 
   gEncryptedURIService =
     Cc["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
     .getService(Ci.nsIEncryptedSMIMEURIsService);
 }
 
-function msgHdrViewSMIMEOnUnload(event)
-{
+function msgHdrViewSMIMEOnUnload(event) {
   window.crypto.enableSmartCardEvents = false;
   document.removeEventListener("smartcard-insert", onSmartCardChange);
   document.removeEventListener("smartcard-remove", onSmartCardChange);
   forgetEncryptedURI();
-  removeEventListener('messagepane-loaded', msgHdrViewSMIMEOnLoad, true);
-  removeEventListener('messagepane-unloaded', msgHdrViewSMIMEOnUnload, true);
-  removeEventListener('messagepane-hide', msgHdrViewSMIMEOnMessagePaneHide, true);
-  removeEventListener('messagepane-unhide', msgHdrViewSMIMEOnMessagePaneUnhide, true);
+  removeEventListener("messagepane-loaded", msgHdrViewSMIMEOnLoad, true);
+  removeEventListener("messagepane-unloaded", msgHdrViewSMIMEOnUnload, true);
+  removeEventListener("messagepane-hide", msgHdrViewSMIMEOnMessagePaneHide, true);
+  removeEventListener("messagepane-unhide", msgHdrViewSMIMEOnMessagePaneUnhide, true);
 }
 
-function msgHdrViewSMIMEOnMessagePaneHide()
-{
+function msgHdrViewSMIMEOnMessagePaneHide() {
   gSMIMEContainer.collapsed = true;
   gSignedUINode.collapsed = true;
   gEncryptedUINode.collapsed = true;
 }
 
-function msgHdrViewSMIMEOnMessagePaneUnhide()
-{
-  if (gEncryptionStatus != -1 || gSignatureStatus != -1)
-  {
+function msgHdrViewSMIMEOnMessagePaneUnhide() {
+  if (gEncryptionStatus != -1 || gSignatureStatus != -1) {
     gSMIMEContainer.collapsed = false;
 
-    if (gSignatureStatus != -1)
-    {
+    if (gSignatureStatus != -1) {
       gSignedUINode.collapsed = false;
     }
 
-    if (gEncryptionStatus != -1)
-    {
+    if (gEncryptionStatus != -1) {
       gEncryptedUINode.collapsed = false;
     }
   }
 }
 
-addEventListener('messagepane-loaded', msgHdrViewSMIMEOnLoad, true);
-addEventListener('messagepane-unloaded', msgHdrViewSMIMEOnUnload, true);
-addEventListener('messagepane-hide', msgHdrViewSMIMEOnMessagePaneHide, true);
-addEventListener('messagepane-unhide', msgHdrViewSMIMEOnMessagePaneUnhide, true);
+addEventListener("messagepane-loaded", msgHdrViewSMIMEOnLoad, true);
+addEventListener("messagepane-unloaded", msgHdrViewSMIMEOnUnload, true);
+addEventListener("messagepane-hide", msgHdrViewSMIMEOnMessagePaneHide, true);
+addEventListener("messagepane-unhide", msgHdrViewSMIMEOnMessagePaneUnhide, true);