Bug 1478572 - Turn on ESLint in mail/components/preferences (manual changes). r=aceman
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 06 Sep 2018 11:24:50 +1200
changeset 33089 2a29ee0adb310b54a6a2df72034953fed8f2b043
parent 33088 0cac668a566b3f8bbfda07a76506b279d50215ec
child 33090 489af20156c6c8b5077faf5ab918a05fb57ced41
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersaceman
bugs1478572
Bug 1478572 - Turn on ESLint in mail/components/preferences (manual changes). r=aceman
mail/components/preferences/.eslintrc.js
mail/components/preferences/aboutPreferences.xml
mail/components/preferences/advanced.js
mail/components/preferences/applicationManager.js
mail/components/preferences/applications.js
mail/components/preferences/attachmentReminder.js
mail/components/preferences/chat.js
mail/components/preferences/compose.js
mail/components/preferences/cookies.js
mail/components/preferences/display.js
mail/components/preferences/dsn.js
mail/components/preferences/dsn.xul
mail/components/preferences/fonts.js
mail/components/preferences/handlers.xml
mail/components/preferences/messagestyle.js
mail/components/preferences/offline.js
mail/components/preferences/permissions.js
mail/components/preferences/preferencesTab.js
mail/components/preferences/privacy.js
mail/components/preferences/security.js
mail/components/preferences/sendoptions.js
new file mode 100644
--- /dev/null
+++ b/mail/components/preferences/.eslintrc.js
@@ -0,0 +1,14 @@
+"use strict";
+
+module.exports = { // eslint-disable-line no-undef
+  "globals": {
+    // preferences.js
+    "AppConstants": true,
+    "MailServices": true,
+    "Services": true,
+    "ExtensionSupport": true,
+
+    // subdialogs.js
+    "gSubDialog": true,
+  },
+};
--- a/mail/components/preferences/aboutPreferences.xml
+++ b/mail/components/preferences/aboutPreferences.xml
@@ -98,19 +98,19 @@
             if (prefpanes[i] == aPaneElement) {
               this._paneDeck.selectedIndex = i;
               if (this.type != "child") {
                 let oldPane = this.lastSelected ? document.getElementById(this.lastSelected) : this.preferencePanes[0];
                 oldPane.selected = !(aPaneElement.selected = true);
                 this.lastSelected = aPaneElement.id;
                 this.currentPane = aPaneElement;
 
-                let targetHeight = parseInt(window.getComputedStyle(this._paneDeckContainer, "").height);
-                let verticalPadding = parseInt(window.getComputedStyle(aPaneElement, "").paddingTop);
-                verticalPadding += parseInt(window.getComputedStyle(aPaneElement, "").paddingBottom);
+                let targetHeight = parseInt(window.getComputedStyle(this._paneDeckContainer).height);
+                let verticalPadding = parseInt(window.getComputedStyle(aPaneElement).paddingTop);
+                verticalPadding += parseInt(window.getComputedStyle(aPaneElement).paddingBottom);
                 if (aPaneElement.contentHeight + verticalPadding < targetHeight)
                   aPaneElement._content.style.height = targetHeight - verticalPadding + "px";
               }
               break;
             }
           }
           let event = document.createEvent("Events");
           event.initEvent("paneSelected", true, true);
--- a/mail/components/preferences/advanced.js
+++ b/mail/components/preferences/advanced.js
@@ -1,13 +1,16 @@
 /* -*- Mode: Java; tab-width: 2; 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/. */
 
+// mail/base/content/aboutDialog-appUpdater.js
+/* globals appUpdater, gAppUpdater */
+
 // Load DownloadUtils module for convertByteUnits
 ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm");
 ChromeUtils.import("resource://gre/modules/Localization.jsm");
 
@@ -68,18 +71,17 @@ var gAdvancedPane = {
       let searchCheckbox = document.getElementById("searchIntegration");
       searchCheckbox.checked = false;
       document.getElementById("searchintegration.enable").disabled = true;
     }
 
     // If the shell service is not working, disable the "Check now" button
     // and "perform check at startup" checkbox.
     try {
-      let shellSvc = Cc["@mozilla.org/mail/shell-service;1"]
-                       .getService(Ci.nsIShellService);
+      Cc["@mozilla.org/mail/shell-service;1"].getService(Ci.nsIShellService);
       this.mShellServiceWorking = true;
     } catch (ex) {
       // The elements may not exist if HAVE_SHELL_SERVICE is off.
       if (document.getElementById("alwaysCheckDefault")) {
         document.getElementById("alwaysCheckDefault").disabled = true;
         document.getElementById("alwaysCheckDefault").checked = false;
       }
       if (document.getElementById("checkDefaultButton"))
@@ -133,17 +135,17 @@ var gAdvancedPane = {
           let relNotesURL = Services.urlFormatter.formatURLPref("app.releaseNotesURL");
           if (relNotesURL != "about:blank") {
             relNotesLink.href = relNotesURL;
             relNotesLink.hidden = false;
           }
         }
       }
 
-      gAppUpdater = new appUpdater();
+      gAppUpdater = new appUpdater(); // eslint-disable-line no-global-assign
     }
 
     this.mInitialized = true;
   },
 
   tabSelectionChanged() {
     if (this.mInitialized) {
       document.getElementById("mail.preferences.advanced.selectedTabIndex")
@@ -208,20 +210,17 @@ var gAdvancedPane = {
         Ci.nsICacheStorageConsumptionObserver,
         Ci.nsISupportsWeakReference,
       ]),
     };
 
     actualSizeLabel.value = prefStrBundle.getString("actualDiskCacheSizeCalculated");
 
     try {
-      let cacheService =
-        Cc["@mozilla.org/netwerk/cache-storage-service;1"]
-          .getService(Ci.nsICacheStorageService);
-      cacheService.asyncGetDiskConsumption(this.observer);
+      Services.cache2.asyncGetDiskConsumption(this.observer);
     } catch (e) {}
   },
 
   updateCacheSizeUI(smartSizeEnabled) {
     document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
     document.getElementById("cacheSize").disabled = smartSizeEnabled;
     document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
   },
@@ -252,91 +251,81 @@ var gAdvancedPane = {
     return isNaN(intValue) ? 0 : intValue * 1024;
   },
 
   /**
    * Clears the cache.
    */
   clearCache() {
     try {
-      let cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
-                    .getService(Ci.nsICacheStorageService);
-      cache.clear();
+      Services.cache2.clear();
     } catch (ex) {}
     this.updateActualCacheSize();
   },
 
-  updateButtons(aButtonID, aPreferenceID) {
-    var button = document.getElementById(aButtonID);
-    var preference = document.getElementById(aPreferenceID);
-    // This is actually before the value changes, so the value is not as you expect.
-    button.disabled = preference.value == true;
-    return undefined;
+  /**
+   * Selects the item of the radiogroup based on the pref values and locked
+   * states.
+   *
+   * UI state matrix for update preference conditions
+   *
+   * UI Components:                              Preferences
+   * Radiogroup                                  i   = app.update.auto
+   */
+  updateReadPrefs() {
+    let autoPref = document.getElementById("app.update.auto");
+    let radiogroup = document.getElementById("updateRadioGroup");
+
+    if (autoPref.value)
+      radiogroup.value = "auto";      // Automatically install updates
+    else
+      radiogroup.value = "checkOnly"; // Check, but let me choose
+
+    let canCheck = Cc["@mozilla.org/updates/update-service;1"].
+                     getService(Ci.nsIApplicationUpdateService).
+                     canCheckForUpdates;
+
+    // canCheck is false if the binary platform or OS version is not known.
+    // A locked pref is sufficient to disable the radiogroup.
+    radiogroup.disabled = !canCheck || autoPref.locked;
+
+    if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
+      // Check to see if the maintenance service is installed.
+      // If it is don't show the preference at all.
+      let installed;
+      try {
+        let wrk = Cc["@mozilla.org/windows-registry-key;1"]
+                    .createInstance(Ci.nsIWindowsRegKey);
+        wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
+                 "SOFTWARE\\Mozilla\\MaintenanceService",
+                 wrk.ACCESS_READ | wrk.WOW64_64);
+        installed = wrk.readIntValue("Installed");
+        wrk.close();
+      } catch (e) { }
+      if (installed != 1) {
+        document.getElementById("useService").hidden = true;
+      }
+    }
   },
 
-/**
- * Selects the item of the radiogroup based on the pref values and locked
- * states.
- *
- * UI state matrix for update preference conditions
- *
- * UI Components:                              Preferences
- * Radiogroup                                  i   = app.update.auto
- */
-updateReadPrefs() {
-  var autoPref = document.getElementById("app.update.auto");
-  var radiogroup = document.getElementById("updateRadioGroup");
-
-  if (autoPref.value)
-    radiogroup.value = "auto";      // Automatically install updates
-  else
-    radiogroup.value = "checkOnly"; // Check, but let me choose
-
-  var canCheck = Cc["@mozilla.org/updates/update-service;1"].
-                   getService(Ci.nsIApplicationUpdateService).
-                   canCheckForUpdates;
-
-  // canCheck is false if the binary platform or OS version is not known.
-  // A locked pref is sufficient to disable the radiogroup.
-  radiogroup.disabled = !canCheck || autoPref.locked;
-
-  if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
-    // Check to see if the maintenance service is installed.
-    // If it is don't show the preference at all.
-    let installed;
-    try {
-      let wrk = Cc["@mozilla.org/windows-registry-key;1"]
-                  .createInstance(Ci.nsIWindowsRegKey);
-      wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
-               "SOFTWARE\\Mozilla\\MaintenanceService",
-               wrk.ACCESS_READ | wrk.WOW64_64);
-      installed = wrk.readIntValue("Installed");
-      wrk.close();
-    } catch (e) { }
-    if (installed != 1) {
-      document.getElementById("useService").hidden = true;
+  /**
+   * Sets the pref values based on the selected item of the radiogroup.
+   */
+  updateWritePrefs() {
+    let autoPref = document.getElementById("app.update.auto");
+    let radiogroup = document.getElementById("updateRadioGroup");
+    switch (radiogroup.value) {
+      case "auto":      // Automatically install updates
+        autoPref.value = true;
+        break;
+      case "checkOnly": // Check, but but let me choose
+        autoPref.value = false;
+        break;
     }
-  }
-},
-
-/**
- * Sets the pref values based on the selected item of the radiogroup.
- */
-updateWritePrefs() {
-  var autoPref = document.getElementById("app.update.auto");
-  var radiogroup = document.getElementById("updateRadioGroup");
-  switch (radiogroup.value) {
-    case "auto":      // Automatically install updates
-      autoPref.value = true;
-      break;
-    case "checkOnly": // Check, but but let me choose
-      autoPref.value = false;
-      break;
-  }
-},
+  },
 
   showUpdates() {
     gSubDialog.open("chrome://mozapps/content/update/history.xul");
   },
 
   updateCompactOptions(aCompactEnabled) {
     document.getElementById("offlineCompactFolderMin").disabled =
       !document.getElementById("offlineCompactFolder").checked ||
@@ -479,23 +468,20 @@ updateWritePrefs() {
    * In all cases, set up the Learn More link sanely
    */
   initTelemetry() {
     if (AppConstants.MOZ_TELEMETRY_REPORTING)
       this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
   },
 
   formatLocaleSetLabels() {
-    const localeService =
-      Cc["@mozilla.org/intl/localeservice;1"]
-        .getService(Ci.mozILocaleService);
     const osprefs =
       Cc["@mozilla.org/intl/ospreferences;1"]
         .getService(Ci.mozIOSPreferences);
-    let appLocale = localeService.getAppLocalesAsBCP47()[0];
+    let appLocale = Services.locale.getAppLocalesAsBCP47()[0];
     let rsLocale = osprefs.getRegionalPrefsLocales()[0];
     let names = Services.intl.getLocaleDisplayNames(undefined, [appLocale, rsLocale]);
     let appLocaleRadio = document.getElementById("appLocale");
     let rsLocaleRadio = document.getElementById("rsLocale");
     let appLocaleLabel = this.mBundle.getFormattedString("appLocale.label",
                                                          [names[0]]);
     let rsLocaleLabel = this.mBundle.getFormattedString("rsLocale.label",
                                                         [names[1]]);
--- a/mail/components/preferences/applicationManager.js
+++ b/mail/components/preferences/applicationManager.js
@@ -1,12 +1,15 @@
 /* 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/. */
 
+// applications.js
+/* globals gApplicationsPane */
+
 var gAppManagerDialog = {
   _removed: [],
 
   init: function appManager_init() {
     this.handlerInfo = window.arguments[0];
 
     var bundle = document.getElementById("appManagerBundle");
     gApplicationsPane._prefsBundle = document.getElementById("bundlePreferences");
--- a/mail/components/preferences/applications.js
+++ b/mail/components/preferences/applications.js
@@ -1,14 +1,21 @@
 /* -*- 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/. */
 
-//* ***************************************************************************//
+// applications.inc.xul
+/* globals ICON_URL_APP */
+// mail/base/content/contentAreaClick.js
+/* globals openLinkExternally */
+// toolkit/content/globalOverlay.js
+/* globals goUpdateCommand */
+
+// ------------------------------
 // Constants & Enumeration Values
 
 var PREF_DISABLED_PLUGIN_TYPES = "plugin.disable_full_page_plugin_for_types";
 
 // Preferences that affect which entries to show in the list.
 var PREF_SHOW_PLUGINS_IN_LIST = "browser.download.show_plugins_in_list";
 var PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS =
   "browser.download.hide_plugins_without_extensions";
@@ -24,17 +31,17 @@ var kActionUsePlugin = 5;
 var APP_ICON_ATTR_NAME = "appHandlerIcon";
 
 // CloudFile account tools used by gCloudFileTab.
 ChromeUtils.import("resource:///modules/cloudFileAccounts.js");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
-//* ***************************************************************************//
+// ---------
 // Utilities
 
 function getDisplayNameForFile(aFile) {
   if (AppConstants.platform == "win") {
     if (aFile instanceof Ci.nsILocalFileWin) {
       try {
         return aFile.getVersionInfoField("FileDescription");
       } catch (ex) {
@@ -82,17 +89,17 @@ ArrayEnumerator.prototype = {
     return this._index < this._contents.length;
   },
 
   getNext() {
     return this._contents[this._index++];
   },
 };
 
-//* ***************************************************************************//
+// ------------------
 // HandlerInfoWrapper
 
 /**
  * This object wraps nsIHandlerInfo with some additional functionality
  * the Applications prefpane needs to display and allow modification of
  * the list of handled types.
  *
  * We create an instance of this wrapper for each entry we might display
@@ -111,26 +118,23 @@ function HandlerInfoWrapper(aType, aHand
 }
 
 HandlerInfoWrapper.prototype = {
   // The wrapped nsIHandlerInfo object.  In general, this object is private,
   // but there are a couple cases where callers access it directly for things
   // we haven't (yet?) implemented, so we make it a public property.
   wrappedHandlerInfo: null,
 
-  //* *************************************************************************//
+  // -----------------
   // Convenience Utils
 
   _handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"]
                  .getService(Ci.nsIHandlerService),
 
-  _categoryMgr: Cc["@mozilla.org/categorymanager;1"]
-                  .getService(Ci.nsICategoryManager),
-
-  //* *************************************************************************//
+  // --------------
   // nsIHandlerInfo
 
   // The MIME type or protocol scheme.
   _type: null,
   get type() {
     return this._type;
   },
 
@@ -159,18 +163,20 @@ HandlerInfoWrapper.prototype = {
   },
 
   get possibleApplicationHandlers() {
     return this.wrappedHandlerInfo.possibleApplicationHandlers;
   },
 
   addPossibleApplicationHandler(aNewHandler) {
     try {
+      /* eslint-disable mozilla/use-includes-instead-of-indexOf */
       if (this.possibleApplicationHandlers.indexOf(0, aNewHandler) != -1)
         return;
+      /* eslint-enable mozilla/use-includes-instead-of-indexOf */
     } catch (e) { }
     this.possibleApplicationHandlers.appendElement(aNewHandler);
   },
 
   removePossibleApplicationHandler(aHandler) {
     var defaultApp = this.preferredApplicationHandler;
     if (defaultApp && aHandler.equals(defaultApp)) {
       // If the app we remove was the default app, we must make sure
@@ -247,18 +253,17 @@ HandlerInfoWrapper.prototype = {
 
     return this.wrappedHandlerInfo.alwaysAskBeforeHandling;
   },
 
   set alwaysAskBeforeHandling(aNewValue) {
     this.wrappedHandlerInfo.alwaysAskBeforeHandling = aNewValue;
   },
 
-
-  //* *************************************************************************//
+  // -----------
   // nsIMIMEInfo
 
   // The primary file extension associated with this type, if any.
   //
   // XXX Plugin objects contain an array of MimeType objects with "suffixes"
   // properties; if this object has an associated plugin, shouldn't we check
   // those properties for an extension?
   get primaryExtension() {
@@ -266,18 +271,17 @@ HandlerInfoWrapper.prototype = {
       if (this.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo &&
           this.wrappedHandlerInfo.primaryExtension)
         return this.wrappedHandlerInfo.primaryExtension;
     } catch (ex) {}
 
     return null;
   },
 
-
-  //* *************************************************************************//
+  // ---------------
   // Plugin Handling
 
   // A plugin that can handle this type, if any.
   //
   // Note: just because we have one doesn't mean it *will* handle the type.
   // That depends on whether or not the type is in the list of types for which
   // plugin handling is disabled.
   plugin: null,
@@ -316,53 +320,48 @@ HandlerInfoWrapper.prototype = {
 
     if (!disabledPluginTypes.includes(this.type))
       disabledPluginTypes.push(this.type);
 
     Services.prefs.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
                                disabledPluginTypes.join(","));
 
     // Update the category manager so existing browser windows update.
-    this._categoryMgr.deleteCategoryEntry("Gecko-Content-Viewers",
-                                          this.type,
-                                          false);
+    Services.catMan.deleteCategoryEntry("Gecko-Content-Viewers", this.type, false);
   },
 
   enablePluginType() {
     var disabledPluginTypes = this._getDisabledPluginTypes();
 
     var type = this.type;
     disabledPluginTypes = disabledPluginTypes.filter(v => v != type);
 
     Services.prefs.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
                                disabledPluginTypes.join(","));
 
     // Update the category manager so existing browser windows update.
-    this._categoryMgr.
-      addCategoryEntry("Gecko-Content-Viewers",
-                       this.type,
-                       "@mozilla.org/content/plugin/document-loader-factory;1",
-                       false,
-                       true);
+    Services.catMan.addCategoryEntry(
+      "Gecko-Content-Viewers", this.type,
+      "@mozilla.org/content/plugin/document-loader-factory;1",
+      false, true
+    );
   },
 
-
-  //* *************************************************************************//
+  // -------
   // Storage
 
   store() {
     this._handlerSvc.store(this.wrappedHandlerInfo);
   },
 
   remove() {
     this._handlerSvc.remove(this.wrappedHandlerInfo);
   },
 
-
-  //* *************************************************************************//
+  // -----
   // Icons
 
   get smallIcon() {
     return this._getIcon(16);
   },
 
   get largeIcon() {
     return this._getIcon(32);
@@ -613,19 +612,21 @@ var gCloudFileTab = {
         gCloudFileTab._accountCache[accountKey].result = aStatusCode;
         gCloudFileTab.onUserInfoRequestDone(accountKey);
       },
       onStartRequest(aRequest, aContext) {
         aItem.setAttribute("state", "connecting");
       },
     };
 
-    let accountInfo = {account,
-                       listItem: aItem,
-                       result: Cr.NS_ERROR_NOT_AVAILABLE};
+    let accountInfo = {
+      account,
+      listItem: aItem,
+      result: Cr.NS_ERROR_NOT_AVAILABLE,
+    };
 
     this._accountCache[accountKey] = accountInfo;
 
     this._settingsDeck.selectedPanel = this._loadingPanel;
     account.refreshUserInfo(aWithUI, observer);
   },
 
   onUserInfoRequestDone: function CFT_onUserInfoRequestDone(aAccountKey) {
@@ -799,17 +800,17 @@ var gCloudFileTab = {
     document.getElementById("cloudFileThreshold").disabled =
     !document.getElementById("enableThreshold").checked;
   },
 
   QueryInterface: ChromeUtils.generateQI(["nsIObserver",
                                           "nsISupportsWeakReference"]),
 };
 
-//* ***************************************************************************//
+// -------------------
 // Prefpane Controller
 
 var gApplicationsPane = {
   // The set of types the app knows how to handle.  A hash of HandlerInfoWrapper
   // objects, indexed by type.
   _handledTypes: {},
 
   // The list of types we can show, sorted by the sort column/direction.
@@ -823,35 +824,34 @@ var gApplicationsPane = {
 
   // A count of the number of times each visible type description appears.
   // We use these counts to determine whether or not to annotate descriptions
   // with their types to distinguish duplicate descriptions from each other.
   // A hash of integer counts, indexed by string description.
   _visibleTypeDescriptionCount: new Map(),
 
 
-  //* *************************************************************************//
+  // -----------------------------------
   // Convenience & Performance Shortcuts
 
   // These get defined by init().
   _brandShortName: null,
   _prefsBundle: null,
   _list: null,
   _filter: null,
 
-  _mimeSvc: Cc["@mozilla.org/mime;1"]
-                    .getService(Ci.nsIMIMEService),
+  _mimeSvc: Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService),
 
   _helperAppSvc: Cc["@mozilla.org/uriloader/external-helper-app-service;1"]
-                    .getService(Ci.nsIExternalHelperAppService),
+                   .getService(Ci.nsIExternalHelperAppService),
 
   _handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"]
-                    .getService(Ci.nsIHandlerService),
+                 .getService(Ci.nsIHandlerService),
 
-  //* *************************************************************************//
+  // ----------------------------
   // Initialization & Destruction
 
   init() {
     // Initialize shortcuts to some commonly accessed elements & values.
     this._brandShortName =
       document.getElementById("bundleBrand").getString("brandShortName");
     this._prefsBundle = document.getElementById("bundlePreferences");
     this._list = document.getElementById("handlersView");
@@ -896,23 +896,22 @@ var gApplicationsPane = {
     setTimeout(_delayedPaneLoad, 0, this);
   },
 
   destroy() {
     Services.prefs.removeObserver(PREF_SHOW_PLUGINS_IN_LIST, this);
     Services.prefs.removeObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
   },
 
-
-  //* *************************************************************************//
+  // -----------
   // nsISupports
 
   QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
 
-  //* *************************************************************************//
+  // -----------
   // nsIObserver
 
   observe(aSubject, aTopic, aData) {
     // Rebuild the list when there are changes to preferences that influence
     // whether or not to show certain entries in the list.
     if (aTopic == "nsPref:changed" && !this._storingAction) {
       // These two prefs alter the list of visible types, so we have to rebuild
       // that list when they change.
@@ -923,27 +922,25 @@ var gApplicationsPane = {
       }
 
       // All the prefs we observe can affect what we display, so we rebuild
       // the view when any of them changes.
       this.rebuildView();
     }
   },
 
-
-  //* *************************************************************************//
+  // -------------
   // EventListener
 
   handleEvent(aEvent) {
     if (aEvent.type == "unload")
       this.destroy();
   },
 
-
-  //* *************************************************************************//
+  // ---------------------------
   // Composed Model Construction
 
   _loadData() {
     this._loadPluginHandlers();
     this._loadApplicationHandlers();
   },
 
   /**
@@ -1005,17 +1002,17 @@ var gApplicationsPane = {
         handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
         this._handledTypes[type] = handlerInfoWrapper;
       }
 
       handlerInfoWrapper.handledOnlyByPlugin = false;
     }
   },
 
-  //* *************************************************************************//
+  // -----------------
   // View Construction
 
   _rebuildVisibleTypes() {
     // Reset the list of visible types and the visible type description counts.
     this._visibleTypes.length = 0;
     this._visibleTypeDescriptionCount.clear();
 
     // Get the preferences that help determine what types to show.
@@ -1400,19 +1397,16 @@ var gApplicationsPane = {
 
     // Select the item corresponding to the preferred action.  If the always
     // ask flag is set, it overrides the preferred action.  Otherwise we pick
     // the item identified by the preferred action (when the preferred action
     // is to use a helper app, we have to pick the specific helper app item).
     if (handlerInfo.alwaysAskBeforeHandling)
       menu.selectedItem = askMenuItem;
     else switch (handlerInfo.preferredAction) {
-      case Ci.nsIHandlerInfo.handleInternally:
-        menu.selectedItem = internalMenuItem;
-        break;
       case Ci.nsIHandlerInfo.useSystemDefault:
         menu.selectedItem = defaultMenuItem;
         break;
       case Ci.nsIHandlerInfo.useHelperApp:
         if (preferredApp)
           menu.selectedItem =
             possibleAppMenuItems.filter(v => v.handlerApp.equals(preferredApp))[0];
         break;
@@ -1424,18 +1418,17 @@ var gApplicationsPane = {
         break;
     }
     // menu.selectedItem may be null if the preferredAction is
     // useSystemDefault, but handlerInfo.hasDefaultHandler returns false.
     // For now, we'll just use the askMenuItem to avoid ugly exceptions.
     menu.previousSelectedItem = menu.selectedItem || askMenuItem;
   },
 
-
-  //* *************************************************************************//
+  // -------------------
   // Sorting & Filtering
 
   _sortColumn: null,
 
   /**
    * Sort the list when the user clicks on a column header.
    */
   sort(event) {
@@ -1490,17 +1483,17 @@ var gApplicationsPane = {
       this._visibleTypes.reverse();
   },
 
   focusFilterBox() {
     this._filter.focus();
     this._filter.select();
   },
 
-  //* *************************************************************************//
+  // -------
   // Changes
 
   onSelectAction(aActionItem) {
     this._storingAction = true;
 
     let typeItem = this._list.selectedItem;
     let menu = document.getAnonymousElementByAttribute(typeItem, "class",
                                                        "actionsMenu");
@@ -1677,17 +1670,16 @@ var gApplicationsPane = {
   confirmDelete(aEvent) {
     aEvent.stopPropagation();
     if (Services.prompt.confirm(null,
                                 this._prefsBundle.getString("confirmDeleteTitle"),
                                 this._prefsBundle.getString("confirmDeleteText")))
       this.onDelete(aEvent);
     else {
       // They hit cancel, so return them to the previously selected item.
-      let typeItem = this._list.selectedItem;
       let menu = document.getAnonymousElementByAttribute(this._list.selectedItem,
                                                          "class", "actionsMenu");
       menu.selectedItem = menu.previousSelectedItem;
     }
   },
 
   onDelete(aEvent) {
     // We want to delete if either the request came from the confirmDelete
--- a/mail/components/preferences/attachmentReminder.js
+++ b/mail/components/preferences/attachmentReminder.js
@@ -16,19 +16,19 @@ var gAttachmentReminderOptionsDialog = {
   },
 
   buildKeywordList() {
     var keywordsInCsv = Services.prefs
       .getComplexValue("mail.compose.attachment_reminder_keywords",
                        Ci.nsIPrefLocalizedString);
     if (!keywordsInCsv)
       return;
-    var keywordsInCsv = keywordsInCsv.data;
+    keywordsInCsv = keywordsInCsv.data;
     var keywordsInArr = keywordsInCsv.split(",");
-    for (var i = 0; i < keywordsInArr.length; i++) {
+    for (let i = 0; i < keywordsInArr.length; i++) {
       if (keywordsInArr[i])
         this.keywordListBox.appendItem(keywordsInArr[i], keywordsInArr[i]);
     }
     if (keywordsInArr.length)
       this.keywordListBox.selectedIndex = 0;
   },
 
   addKeyword() {
--- a/mail/components/preferences/chat.js
+++ b/mail/components/preferences/chat.js
@@ -1,26 +1,30 @@
 /* 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/. */
 
+// messagestyle.js
+/* globals previewObserver */
+
 var gChatPane = {
   init() {
     previewObserver.load();
     this.updateDisabledState();
     this.updatePlaySound();
   },
 
   updateDisabledState() {
     let broadcaster = document.getElementById("idleReportingEnabled");
     if (document.getElementById("messenger.status.reportIdle").value) {
       broadcaster.removeAttribute("disabled");
       this.updateMessageDisabledState();
-    } else
+    } else {
       broadcaster.setAttribute("disabled", "true");
+    }
   },
 
   updateMessageDisabledState() {
     let textbox = document.getElementById("defaultIdleAwayMessage");
     if (document.getElementById("messenger.status.awayWhenIdle").value)
       textbox.removeAttribute("disabled");
     else
       textbox.setAttribute("disabled", "true");
--- a/mail/components/preferences/compose.js
+++ b/mail/components/preferences/compose.js
@@ -157,17 +157,17 @@ var gComposePane = {
 
   populateFonts() {
     var fontsList = document.getElementById("FontSelect");
     try {
       var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
                          .getService(Ci.nsIFontEnumerator);
       var localFontCount = { value: 0 };
       var localFonts = enumerator.EnumerateAllFonts(localFontCount);
-      for (var i = 0; i < localFonts.length; ++i) {
+      for (let i = 0; i < localFonts.length; ++i) {
         // Remove Linux system generic fonts that collide with CSS generic fonts.
         if (localFonts[i] != "" && localFonts[i] != "serif" &&
             localFonts[i] != "sans-serif" && localFonts[i] != "monospace")
           fontsList.appendItem(localFonts[i], localFonts[i]);
       }
     } catch (e) { }
     // Choose the item after the list is completely generated.
     var preference = document.getElementById(fontsList.getAttribute("preference"));
--- a/mail/components/preferences/cookies.js
+++ b/mail/components/preferences/cookies.js
@@ -43,18 +43,19 @@ var gCookiesWindow = {
     if (this._view.rowCount > 0)
       this._tree.view.selection.select(0);
 
     if (aInitialLoad) {
       if (("arguments" in window) && window.arguments[2] &&
           window.arguments[2].filterString) {
         this.setFilter(window.arguments[2].filterString);
       }
-    } else if (document.getElementById("filter").value != "")
-        this.filter();
+    } else if (document.getElementById("filter").value != "") {
+      this.filter();
+    }
 
     this._saveState();
   },
 
   _cookieEquals(aCookieA, aCookieB, aStrippedHost) {
     return aCookieA.rawHost == aStrippedHost &&
            aCookieA.name == aCookieB.name &&
            aCookieA.path == aCookieB.path &&
@@ -109,18 +110,19 @@ var gCookiesWindow = {
               currCookie.value    = changedCookie.value;
               currCookie.isSecure = changedCookie.isSecure;
               currCookie.isDomain = changedCookie.isDomain;
               currCookie.expires  = changedCookie.expires;
               cookieItem = currCookie;
               break;
             }
           }
-        } else if (hostItem.open)
+        } else if (hostItem.open) {
           rowIndex += hostItem.cookies.length;
+        }
       }
     } else {
       // Just walk the filter list to find the item. It doesn't matter that
       // we don't update the main Host collection when we do this, because
       // when the filter is reset the Host collection is rebuilt anyway.
       for (rowIndex = 0; rowIndex < this._view._filterSet.length; ++rowIndex) {
         currCookie = this._view._filterSet[rowIndex];
         if (this._cookieEquals(currCookie, changedCookie, strippedHost)) {
@@ -189,83 +191,85 @@ var gCookiesWindow = {
 
       var cacheIndex = Math.min(this._cacheValid, aIndex);
       if (cacheIndex > 0) {
         var cacheItem = this._cacheItems[cacheIndex];
         start = cacheItem.start;
         count = hostIndex = cacheItem.count;
       }
 
-      for (var i = start; i < gCookiesWindow._hostOrder.length; ++i) { // var host in gCookiesWindow._hosts) {
-        var currHost = gCookiesWindow._hosts[gCookiesWindow._hostOrder[i]]; // gCookiesWindow._hosts[host];
+      for (let i = start; i < gCookiesWindow._hostOrder.length; ++i) {
+        let currHost = gCookiesWindow._hosts[gCookiesWindow._hostOrder[i]];
         if (!currHost) continue;
         if (count == aIndex)
           return currHost;
         hostIndex = count;
 
-        var cacheEntry = { "start": i, "count": count };
+        let cacheEntry = { start: i, count };
         var cacheStart = count;
 
         if (currHost.open) {
           if (count < aIndex && aIndex <= (count + currHost.cookies.length)) {
             // We are looking for an entry within this host's children,
             // enumerate them looking for the index.
             ++count;
-            for (var i = 0; i < currHost.cookies.length; ++i) {
+            for (let j = 0; j < currHost.cookies.length; ++j) {
               if (count == aIndex) {
-                var cookie = currHost.cookies[i];
+                let cookie = currHost.cookies[j];
                 cookie.parentIndex = hostIndex;
                 return cookie;
               }
               ++count;
             }
           } else {
             // A host entry was open, but we weren't looking for an index
             // within that host entry's children, so skip forward over the
             // entry's children. We need to add one to increment for the
             // host value too.
             count += currHost.cookies.length + 1;
           }
-        } else
+        } else {
           ++count;
+        }
 
-        for (var j = cacheStart; j < count; j++)
+        for (let j = cacheStart; j < count; j++) {
           this._cacheItems[j] = cacheEntry;
+        }
         this._cacheValid = count - 1;
       }
       return null;
     },
 
     _removeItemAtIndex(aIndex, aCount) {
       var removeCount = aCount === undefined ? 1 : aCount;
       if (this._filtered) {
         // remove the cookies from the unfiltered set so that they
         // don't reappear when the filter is changed. See bug 410863.
-        for (var i = aIndex; i < aIndex + removeCount; ++i) {
-          var item = this._filterSet[i];
-          var parent = gCookiesWindow._hosts[item.rawHost];
+        for (let i = aIndex; i < aIndex + removeCount; ++i) {
+          let item = this._filterSet[i];
+          let parent = gCookiesWindow._hosts[item.rawHost];
           for (var j = 0; j < parent.cookies.length; ++j) {
             if (item == parent.cookies[j]) {
               parent.cookies.splice(j, 1);
               break;
             }
           }
         }
         this._filterSet.splice(aIndex, removeCount);
         return;
       }
 
-      var item = this._getItemAtIndex(aIndex);
+      let item = this._getItemAtIndex(aIndex);
       if (!item) return;
       this._invalidateCache(aIndex - 1);
       if (item.container) {
         gCookiesWindow._hosts[item.rawHost] = null;
       } else {
-        var parent = this._getItemAtIndex(item.parentIndex);
-        for (var i = 0; i < parent.cookies.length; ++i) {
+        let parent = this._getItemAtIndex(item.parentIndex);
+        for (let i = 0; i < parent.cookies.length; ++i) {
           var cookie = parent.cookies[i];
           if (item.rawHost == cookie.rawHost &&
               item.name == cookie.name &&
               item.path == cookie.path &&
               !ChromeUtils.compareOriginAttributes(item.originAttributes,
                                                    cookie.originAttributes)) {
             parent.cookies.splice(i, removeCount);
           }
@@ -275,26 +279,30 @@ var gCookiesWindow = {
 
     _invalidateCache(aIndex) {
       this._cacheValid = Math.min(this._cacheValid, aIndex);
     },
 
     getCellText(aIndex, aColumn) {
       if (!this._filtered) {
         var item = this._getItemAtIndex(aIndex);
-        if (!item)
+        if (!item) {
           return "";
-        if (aColumn.id == "domainCol")
+        }
+        if (aColumn.id == "domainCol") {
           return item.rawHost;
-        else if (aColumn.id == "nameCol")
+        }
+        if (aColumn.id == "nameCol") {
           return ("name" in item) ? item.name : "";
-      } else if (aColumn.id == "domainCol")
-          return this._filterSet[aIndex].rawHost;
-        else if (aColumn.id == "nameCol")
-          return ("name" in this._filterSet[aIndex]) ? this._filterSet[aIndex].name : "";
+        }
+      } else if (aColumn.id == "domainCol") {
+        return this._filterSet[aIndex].rawHost;
+      } else if (aColumn.id == "nameCol") {
+        return ("name" in this._filterSet[aIndex]) ? this._filterSet[aIndex].name : "";
+      }
       return "";
     },
 
     _selection: null,
     get selection() { return this._selection; },
     set selection(val) { this._selection = val; return val; },
     getRowProperties(aRow) { return ""; },
     getCellProperties(aRow, aColumn) { return ""; },
@@ -352,20 +360,19 @@ var gCookiesWindow = {
           if (item.container) {
             for (var i = aIndex + 1; i < this.rowCount; ++i) {
               var subsequent = this._getItemAtIndex(i);
               if (subsequent.container)
                 return true;
             }
             return false;
           }
-            var parent = this._getItemAtIndex(item.parentIndex);
-            if (parent && parent.container)
-              return aIndex < item.parentIndex + parent.cookies.length;
-
+          let parent = this._getItemAtIndex(item.parentIndex);
+          if (parent && parent.container)
+            return aIndex < item.parentIndex + parent.cookies.length;
         }
       }
       return aIndex < this.rowCount - 1;
     },
     hasPreviousSibling(aIndex) {
       if (!this._filtered) {
         var item = this._getItemAtIndex(aIndex);
         if (!item) return false;
@@ -418,58 +425,61 @@ var gCookiesWindow = {
 
   _makeStrippedHost(aHost) {
     let formattedHost = aHost.startsWith(".") ? aHost.substring(1, aHost.length) : aHost;
     return formattedHost.startsWith("www.") ? formattedHost.substring(4, formattedHost.length) : formattedHost;
   },
 
   _addCookie(aStrippedHost, aCookie, aHostCount) {
     if (!(aStrippedHost in this._hosts) || !this._hosts[aStrippedHost]) {
-      this._hosts[aStrippedHost] = { cookies: [],
-                                     rawHost: aStrippedHost,
-                                     level: 0,
-                                     open: false,
-                                     container: true };
+      this._hosts[aStrippedHost] = {
+        cookies: [],
+        rawHost: aStrippedHost,
+        level: 0,
+        open: false,
+        container: true,
+      };
       this._hostOrder.push(aStrippedHost);
       ++aHostCount.value;
     }
 
     var c = this._makeCookieObject(aStrippedHost, aCookie);
     this._hosts[aStrippedHost].cookies.push(c);
   },
 
   _makeCookieObject(aStrippedHost, aCookie) {
-    let host = aCookie.host;
-    let formattedHost = host.startsWith(".") ? host.substring(1) : host;
-    let c = { name: aCookie.name,
-              value: aCookie.value,
-              isDomain: aCookie.isDomain,
-              host: aCookie.host,
-              rawHost: aStrippedHost,
-              path: aCookie.path,
-              isSecure: aCookie.isSecure,
-              expires: aCookie.expires,
-              level: 1,
-              container: false,
-              originAttributes: aCookie.originAttributes };
+    let c = {
+      name: aCookie.name,
+      value: aCookie.value,
+      isDomain: aCookie.isDomain,
+      host: aCookie.host,
+      rawHost: aStrippedHost,
+      path: aCookie.path,
+      isSecure: aCookie.isSecure,
+      expires: aCookie.expires,
+      level: 1,
+      container: false,
+      originAttributes: aCookie.originAttributes,
+    };
     return c;
   },
 
   _loadCookies() {
     var e = Services.cookies.enumerator;
     var hostCount = { value: 0 };
     this._hosts = {};
     this._hostOrder = [];
     while (e.hasMoreElements()) {
       var cookie = e.getNext();
       if (cookie && cookie instanceof Ci.nsICookie) {
         var strippedHost = this._makeStrippedHost(cookie.host);
         this._addCookie(strippedHost, cookie, hostCount);
-      } else
+      } else {
         break;
+      }
     }
     this._view._rowCount = hostCount.value;
   },
 
   formatExpiresString(aExpires) {
     if (aExpires) {
       var date = new Date(1000 * aExpires);
       const dateTimeFormatter = new Services.intl.DateTimeFormat(undefined, {
@@ -533,17 +543,17 @@ var gCookiesWindow = {
         item = this._view._getItemAtIndex(j);
         if (!item) continue;
         if (item.container && !item.open)
           selectedCookieCount += item.cookies.length;
         else if (!item.container)
           ++selectedCookieCount;
       }
     }
-    var item = this._view._getItemAtIndex(seln.currentIndex);
+    item = this._view._getItemAtIndex(seln.currentIndex);
     if (item && seln.count == 1 && item.container && item.open)
       selectedCookieCount += 2;
 
     let buttonLabel = this._bundle.getString("removeSelectedCookies");
     let removeSelectedCookies = document.getElementById("removeSelectedCookies");
     removeSelectedCookies.label = PluralForm.get(selectedCookieCount, buttonLabel)
                                             .replace("#1", selectedCookieCount);
 
@@ -607,17 +617,17 @@ var gCookiesWindow = {
 
     var nextSelected = 0;
     var rowCountImpact = 0;
     var deleteItems = [];
     if (!this._view._filtered) {
       var ci = seln.currentIndex;
       nextSelected = ci;
       var invalidateRow = -1;
-      var item = this._view._getItemAtIndex(ci);
+      let item = this._view._getItemAtIndex(ci);
       if (item.container) {
         rowCountImpact -= (item.open ? item.cookies.length : 0) + 1;
         deleteItems = deleteItems.concat(item.cookies);
         if (!this._view.hasNextSibling(-1, ci))
           --nextSelected;
         this._view._removeItemAtIndex(ci);
       } else {
         var parent = this._view._getItemAtIndex(item.parentIndex);
@@ -660,18 +670,17 @@ var gCookiesWindow = {
         tbo.rowCountChanged(min.value, rowCountImpact);
       }
     }
 
     var blockFutureCookies = false;
     if (Services.prefs.prefHasUserValue("network.cookie.blockFutureCookies"))
       blockFutureCookies = Services.prefs
         .getBoolPref("network.cookie.blockFutureCookies");
-    for (i = 0; i < deleteItems.length; ++i) {
-      var item = deleteItems[i];
+    for (let item of deleteItems) {
       Services.cookies.remove(item.host, item.name, item.path,
                               item.originAttributes, blockFutureCookies);
     }
 
     if (nextSelected < 0)
       seln.clearSelection();
     else {
       seln.select(nextSelected);
@@ -775,18 +784,18 @@ var gCookiesWindow = {
     return aCookie.rawHost.includes(this._view._filterValue) ||
            aCookie.name.includes(this._view._filterValue) ||
            aCookie.value.includes(this._view._filterValue);
   },
 
   _filterCookies(aFilterValue) {
     this._view._filterValue = aFilterValue;
     var cookies = [];
-    for (var i = 0; i < gCookiesWindow._hostOrder.length; ++i) { // var host in gCookiesWindow._hosts) {
-      var currHost = gCookiesWindow._hosts[gCookiesWindow._hostOrder[i]]; // gCookiesWindow._hosts[host];
+    for (let i = 0; i < gCookiesWindow._hostOrder.length; ++i) {
+      let currHost = gCookiesWindow._hosts[gCookiesWindow._hostOrder[i]];
       if (!currHost) continue;
       for (var j = 0; j < currHost.cookies.length; ++j) {
         var cookie = currHost.cookies[j];
         if (this._cookieMatchesFilter(cookie))
           cookies.push(cookie);
       }
     }
     return cookies;
--- a/mail/components/preferences/display.js
+++ b/mail/components/preferences/display.js
@@ -1,13 +1,16 @@
 /* -*- 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/. */
 
+// toolkit/mozapps/preferences/fontbuilder.js
+/* globals FontBuilder */
+
 var gDisplayPane = {
   mInitialized: false,
   mTagListBox:  null,
 
   init() {
     if (!(("arguments" in window) && window.arguments[1])) {
       // If no tab was specified, select the last used tab.
       let preference = document.getElementById("mail.preferences.display.selectedTabIndex");
@@ -221,25 +224,23 @@ var gDisplayPane = {
   /**
    * Open the edit tag dialog
    */
   editTag() {
     var index = this.mTagListBox.selectedIndex;
     if (index >= 0) {
       var tagElToEdit = this.mTagListBox.getItemAtIndex(index);
       var args = {result: "", keyToEdit: tagElToEdit.getAttribute("value"), okCallback: editTagCallback};
-      let dialog = gSubDialog.open("chrome://messenger/content/newTagDialog.xul",
-                                   "resizable=no", args);
+      gSubDialog.open("chrome://messenger/content/newTagDialog.xul", "resizable=no", args);
     }
   },
 
   addTag() {
     var args = {result: "", okCallback: addTagCallback};
-    let dialog = gSubDialog.open("chrome://messenger/content/newTagDialog.xul",
-                                 "resizable=no", args);
+    gSubDialog.open("chrome://messenger/content/newTagDialog.xul", "resizable=no", args);
   },
 
   onSelect() {
     let btnEdit = document.getElementById("editTagButton");
     let listBox = document.getElementById("tagList");
 
     if (listBox.selectedCount > 0)
       btnEdit.disabled = false;
deleted file mode 100644
--- a/mail/components/preferences/dsn.js
+++ /dev/null
@@ -1,67 +0,0 @@
-# -*- Mode: Java; tab-width: 2; 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 requestAlways;
-var requestAlwaysPref;
-
-var requestOnSuccess;
-var requestOnSuccessPref;
-
-var requestOnFailure;
-var requestOnFailurePref;
-
-var requestOnDelay;
-var requestOnDelayPref;
-
-var requestNever;
-var requestNeverPref;
-
-function onInit()
-{
-  requestAlways = document.getElementById("always_request_on");
-  requestAlwaysPref = document.getElementById("mail.dsn.always_request_on");
-
-  requestOnSuccess = document.getElementById("request_on_success_on");
-  requestOnSuccessPref = document.getElementById("mail.dsn.request_on_success_on");
-
-  requestOnFailure = document.getElementById("request_on_failure_on");
-  requestOnFailurePref = document.getElementById("mail.dsn.request_on_failure_on");
-
-  requestOnDelay = document.getElementById("request_on_delay_on");
-  requestOnDelayPref = document.getElementById("mail.dsn.request_on_delay_on");
-
-  requestNever = document.getElementById("request_never_on");
-  requestNeverPref = document.getElementById("mail.dsn.request_never_on");
-
-  EnableDisableAllowedDSNRequests(new Object());
-
-  return true;
-}
-
-function EnableDisableAllowedDSNRequests(target)
-{
-  var s = requestOnSuccess.checked;
-  var f = requestOnFailure.checked;
-  var d = requestOnDelay.checked;
-  var n = requestNever.checked;
-
-  // Case when the checkbox requestAlways must be enabled
-  if (s || f || d || n) {
-    requestAlways.disabled = false;
-
-  // Case when the checkbox requestAlways must be disabled
-  } else if (!d && !n && !s && !f) {
-    requestAlwaysPref.value = false;
-    requestAlways.disabled = true;
-  }
-
-  // Checkbox requestNever is exclusive with checkboxes requestOnSuccess, requestOnFailure, requestOnDelay
-  if (target == requestNever) {
-    requestOnSuccessPref.value = requestOnFailurePref.value = requestOnDelayPref.value = false;
-
-  } else if (target == requestOnSuccess || target == requestOnFailure || target == requestOnDelay) {
-    requestNeverPref.value = false;
-  }
-}
deleted file mode 100644
--- a/mail/components/preferences/dsn.xul
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0"?>
-
-# -*- Mode: Java; tab-width: 2; 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/.
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<!DOCTYPE prefwindow [
-<!ENTITY % dsnDTD SYSTEM "chrome://messenger/locale/preferences/dsn.dtd">
-%dsnDTD;
-]>
-
-<prefwindow id="DSNDialog" type="child"
-            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-            dlgbuttons="accept,cancel"
-            title="&dialog.title;">
-
-  <script type="application/javascript" src="chrome://messenger/content/preferences/dsn.js"/>
-
-  <prefpane id="DSNDialogPane" onpaneload="onInit();">
-    <preferences id="DSNPreferences">
-      <preference id="mail.dsn.request_on_success_on"
-                  name="mail.dsn.request_on_success_on"
-                  type="bool"/>
-
-      <preference id="mail.dsn.request_on_failure_on"
-                  name="mail.dsn.request_on_failure_on"
-                  type="bool"/>
-
-      <preference id="mail.dsn.request_on_delay_on"
-                  name="mail.dsn.request_on_delay_on"
-                  type="bool"/>
-
-      <preference id="mail.dsn.request_never_on"
-                  name="mail.dsn.request_never_on"
-                  type="bool"/>
-
-      <preference id="mail.dsn.always_request_on"
-                  name="mail.dsn.always_request_on"
-                  type="bool"/>
-
-      <preference id="mail.dsn.ret_full_on"
-                  name="mail.dsn.ret_full_on"
-                  type="bool"/>
-    </preferences>
-
-    <description>&optionTitle.label;</description>
-
-    <!-- When this checkbox is checked, DSN request is sent with SUCCESS option -->
-    <checkbox id="request_on_success_on"
-              label="&requestOnSucess.label;"
-              preference="mail.dsn.request_on_success_on"
-              accesskey="&requestOnSucess.accesskey;"
-              oncommand="EnableDisableAllowedDSNRequests(this)"/>
-
-    <!-- When this checkbox is checked, DSN request is sent with FAILURE option -->
-    <checkbox id="request_on_failure_on"
-              label="&requestOnFailure.label;"
-              preference="mail.dsn.request_on_failure_on"
-              accesskey="&requestOnFailure.accesskey;"
-              oncommand="EnableDisableAllowedDSNRequests(this)"/>
-
-    <!-- When this checkbox is checked, DSN request is sent with DELAY option -->
-    <checkbox id="request_on_delay_on"
-              label="&requestOnDelay.label;"
-              preference="mail.dsn.request_on_delay_on"
-              accesskey="&requestOnDelay.accesskey;"
-              oncommand="EnableDisableAllowedDSNRequests(this)"/>
-
-    <!-- When this checkbox is checked, DSN request is sent with NEVER option -->
-    <checkbox id="request_never_on"
-              label="&requestNever.label;"
-              preference="mail.dsn.request_never_on"
-              accesskey="&requestNever.accesskey;"
-              oncommand="EnableDisableAllowedDSNRequests(this)"/>
-
-    <separator class="thin"/>
-    <separator class="groove"/>
-    <separator class="thin"/>
-
-    <checkbox id="always_request_on"
-              label="&requestAlways.label;"
-              preference="mail.dsn.always_request_on"
-              accesskey="&requestAlways.accesskey;"/>
-
-    <separator class="thin"/>
-    <separator class="groove"/>
-    <separator class="thin"/>
-
-    <label value="&RET_FailureMessage.label;" control="ret_full_on"/>
-    <radiogroup id="ret_full_on" preference="mail.dsn.ret_full_on" orient="horizontal">
-      <radio value="true" label="&RET_FULL.label;" accesskey="&RET_FULL.accesskey;" />
-      <radio value="false" label="&RET_HDRS.label;" accesskey="&RET_HDRS.accesskey;" />
-    </radiogroup>
-
-    <separator class="thin"/>
-  </prefpane>
-</prefwindow>
--- a/mail/components/preferences/fonts.js
+++ b/mail/components/preferences/fonts.js
@@ -1,13 +1,18 @@
 /* -*- 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/. */
 
+// toolkit/content/preferencesBindings.js
+/* globals Preferences */
+// toolkit/mozapps/preferences/fontbuilder.js
+/* globals FontBuilder */
+
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var kDefaultFontType          = "font.default.%LANG%";
 var kFontNameFmtSerif         = "font.name.serif.%LANG%";
 var kFontNameFmtSansSerif     = "font.name.sans-serif.%LANG%";
 var kFontNameFmtMonospace     = "font.name.monospace.%LANG%";
 var kFontNameListFmtSerif     = "font.name-list.serif.%LANG%";
 var kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
--- a/mail/components/preferences/handlers.xml
+++ b/mail/components/preferences/handlers.xml
@@ -13,16 +13,18 @@
       <property name="type" readonly="true">
         <getter>
           return this.getAttribute("type");
         </getter>
       </property>
       <!-- Overriding listitem -->
       <property name="selected" onget="return this.getAttribute('selected') == 'true';">
         <setter><![CDATA[
+          // applications.js
+          /* globals gApplicationsPane */
           if (val) {
             this.setAttribute("selected", "true");
             gApplicationsPane.rebuildActionsMenu();
           } else {
             this.removeAttribute("selected");
           }
 
           document.getAnonymousElementByAttribute(this, "anonid", "selected").setAttribute("hidden", !val);
--- a/mail/components/preferences/messagestyle.js
+++ b/mail/components/preferences/messagestyle.js
@@ -1,15 +1,15 @@
 /* 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 jsProtoHelper = {};
 ChromeUtils.import("resource:///modules/jsProtoHelper.jsm", jsProtoHelper);
-ChromeUtils.import("resource:///modules/imThemes.jsm");
+const { getThemeByName, getThemeVariants } = ChromeUtils.import("resource:///modules/imThemes.jsm", null);
 
 function Conversation(aName) {
   this._name = aName;
   this._observers = [];
   let now = new Date();
   this._date = new Date(now.getFullYear(), now.getMonth(), now.getDate(),
                         10, 42, 22) * 1000;
 }
@@ -50,18 +50,16 @@ var previewObserver = {
     conv.messages = [
       new Message(msg.buddy1, msg.message1, {outgoing: true, _alias: msg.nick1, time: makeDate("10:42:22"), _conversation: conv}),
       new Message(msg.buddy1, msg.message2, {outgoing: true, _alias: msg.nick1, time: makeDate("10:42:25"), _conversation: conv}),
       new Message(msg.buddy2, msg.message3, {incoming: true, _alias: msg.nick2, time: makeDate("10:43:01"), _conversation: conv}),
     ];
     previewObserver.conv = conv;
 
     let themeName = document.getElementById("messagestyle-themename");
-    if (themeName.value && !themeName.selectedItem)
-      themeName.value = themeName.value;
     previewObserver.browser = document.getElementById("previewbrowser");
     document.getElementById("showHeaderCheckbox")
             .addEventListener("CheckboxStateChange",
                               previewObserver.showHeaderChanged);
     previewObserver.displayTheme(themeName.value);
     this._loaded = true;
   },
 
--- a/mail/components/preferences/offline.js
+++ b/mail/components/preferences/offline.js
@@ -8,12 +8,13 @@ var kRememberLastState = 0;
 var gOfflineDialog = {
   dialogSetup() {
     let offlineAutoDetection = document.getElementById("offline.autoDetect");
     let offlineStartupStatePref = document.getElementById("offline.startup_state");
 
     offlineStartupStatePref.disabled = offlineAutoDetection.value;
     if (offlineStartupStatePref.disabled) {
       offlineStartupStatePref.value = kAutomatic;
-    } else if (offlineStartupStatePref.value == kAutomatic)
-        offlineStartupStatePref.value = kRememberLastState;
+    } else if (offlineStartupStatePref.value == kAutomatic) {
+      offlineStartupStatePref.value = kRememberLastState;
+    }
   },
 };
--- a/mail/components/preferences/permissions.js
+++ b/mail/components/preferences/permissions.js
@@ -1,12 +1,15 @@
 /* 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/. */
 
+// toolkit/content/treeUtils.js
+/* globals gTreeUtils */
+
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
 var nsIPermissionManager = Ci.nsIPermissionManager;
 var nsICookiePermission = Ci.nsICookiePermission;
 
 var NOTIFICATION_FLUSH_PERMISSIONS = "flush-pending-permissions";
 
@@ -219,17 +222,17 @@ var gPermissionManager = {
       this.uninit();
     }
 
     this._type = aParams.permissionType;
     this._manageCapability = aParams.manageCapability;
 
     var permissionsText = document.getElementById("permissionsText");
     while (permissionsText.hasChildNodes())
-      permissionsText.removeChild(permissionsText.firstChild);
+      permissionsText.firstChild.remove();
     permissionsText.appendChild(document.createTextNode(aParams.introText));
 
     document.title = aParams.windowTitle;
 
     document.getElementById("btnBlock").hidden    = !aParams.blockVisible;
     document.getElementById("btnSession").hidden  = !aParams.sessionVisible;
     document.getElementById("btnAllow").hidden    = !aParams.allowVisible;
 
@@ -373,17 +376,16 @@ var gPermissionManager = {
     window.close();
   },
 
   _loadPermissions() {
     this._tree = document.getElementById("permissionsTree");
     this._permissions = [];
 
     // load permissions into a table
-    var count = 0;
     var enumerator = Services.perms.enumerator;
     while (enumerator.hasMoreElements()) {
       var nextPermission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
       this._addPermissionToList(nextPermission);
     }
 
     this._view._rowCount = this._permissions.length;
 
--- a/mail/components/preferences/preferencesTab.js
+++ b/mail/components/preferences/preferencesTab.js
@@ -1,12 +1,15 @@
 /* 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/. */
 
+// mail/base/content/specialTabs.js
+/* globals contentTabBaseType, DOMLinkHandler */
+
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource:///modules/errUtils.js");
 
 var gPrefTab = null;
 
 /**
  * A tab to show Preferences.
--- a/mail/components/preferences/privacy.js
+++ b/mail/components/preferences/privacy.js
@@ -55,23 +55,25 @@ var gPrivacyPane = {
     return accept.checked ? 0 : 2;
   },
 
   /**
    * Displays fine-grained, per-site preferences for cookies.
    */
   showCookieExceptions() {
     let bundle = document.getElementById("bundlePreferences");
-    let params = { blockVisible: true,
-                   sessionVisible: true,
-                   allowVisible: true,
-                   prefilledHost: "",
-                   permissionType: "cookie",
-                   windowTitle: bundle.getString("cookiepermissionstitle"),
-                   introText: bundle.getString("cookiepermissionstext") };
+    let params = {
+      blockVisible: true,
+      sessionVisible: true,
+      allowVisible: true,
+      prefilledHost: "",
+      permissionType: "cookie",
+      windowTitle: bundle.getString("cookiepermissionstitle"),
+      introText: bundle.getString("cookiepermissionstext"),
+    };
     gSubDialog.open("chrome://messenger/content/preferences/permissions.xul",
                     null, params);
   },
 
   /**
    * Displays all the user's cookies in a dialog.
    */
   showCookies(aCategory) {
@@ -113,19 +115,21 @@ var gPrivacyPane = {
 
   /**
    * Displays fine-grained, per-site preferences for remote content.
    * We use the "image" type for that, but it can also be stylesheets or
    * iframes.
    */
   showRemoteContentExceptions() {
     let bundle = document.getElementById("bundlePreferences");
-    let params = { blockVisible: true,
-                   sessionVisible: false,
-                   allowVisible: true,
-                   prefilledHost: "",
-                   permissionType: "image",
-                   windowTitle: bundle.getString("imagepermissionstitle"),
-                   introText: bundle.getString("imagepermissionstext") };
+    let params = {
+      blockVisible: true,
+      sessionVisible: false,
+      allowVisible: true,
+      prefilledHost: "",
+      permissionType: "image",
+      windowTitle: bundle.getString("imagepermissionstitle"),
+      introText: bundle.getString("imagepermissionstext"),
+    };
     gSubDialog.open("chrome://messenger/content/preferences/permissions.xul",
                     null, params);
   },
 };
--- a/mail/components/preferences/security.js
+++ b/mail/components/preferences/security.js
@@ -64,18 +64,19 @@ var gSecurityPane = {
 
 
   /**
    * Reload the current message after a preference affecting the view
    * has been changed and we are in instantApply mode.
    */
   reloadMessageInOpener() {
     if (Services.prefs.getBoolPref("browser.preferences.instantApply") &&
-       window.opener && typeof(window.opener.ReloadMessage) == "function")
+        window.opener && typeof(window.opener.ReloadMessage) == "function") {
       window.opener.ReloadMessage();
+    }
   },
 
   /**
    * Initializes master password UI: the "use master password" checkbox, selects
    * the master password button to show, and enables/disables it as necessary.
    * The master password is controlled by various bits of NSS functionality,
    * so the UI for it can't be controlled by the normal preference bindings.
    */
@@ -142,12 +143,13 @@ var gSecurityPane = {
    * Shows the sites where the user has saved passwords and the associated
    * login information.
    */
   showPasswords() {
     gSubDialog.open("chrome://passwordmgr/content/passwordManager.xul");
   },
 
   updateDownloadedPhishingListState() {
-    document.getElementById("useDownloadedList").disabled = !document.getElementById("enablePhishingDetector").checked;
+    document.getElementById("useDownloadedList").disabled =
+      !document.getElementById("enablePhishingDetector").checked;
   },
 
 };
--- a/mail/components/preferences/sendoptions.js
+++ b/mail/components/preferences/sendoptions.js
@@ -10,52 +10,50 @@ var gSendOptionsDialog = {
   mHTMLListBox: null,
   mPlainTextListBox: null,
 
   init() {
     this.mPrefsBundle = document.getElementById("bundlePreferences");
     this.mHTMLListBox = document.getElementById("html_domains");
     this.mPlainTextListBox = document.getElementById("plaintext_domains");
 
-    var htmlDomainPrefString = document.getElementById("mailnews.html_domains").value;
     this.loadDomains(document.getElementById("mailnews.html_domains").value,
                      this.mHTMLListBox);
     this.loadDomains(document.getElementById("mailnews.plaintext_domains").value,
                      this.mPlainTextListBox);
   },
 
   saveDomainPref(aHTML) {
     var listbox = aHTML ? this.mHTMLListBox : this.mPlainTextListBox;
     var num_domains = 0;
     var pref_string = "";
 
-    for (var item = listbox.firstChild; item != null; item = item.nextSibling) {
+    for (let item = listbox.firstChild; item != null; item = item.nextSibling) {
       var domainid = item.firstChild.getAttribute("value");
       if (domainid.length > 1) {
         num_domains++;
 
         // Separate >1 domains by commas.
         if (num_domains > 1)
           pref_string = pref_string + "," + domainid;
         else
           pref_string = domainid;
       }
     }
 
     return pref_string;
   },
 
   loadDomains(aPrefString, aListBox) {
-    var arrayOfPrefs = aPrefString.split(",");
-    if (arrayOfPrefs)
-      for (var i = 0; i < arrayOfPrefs.length; i++) {
-        var str = arrayOfPrefs[i].replace(/ /g, "");
-        if (str)
-          this.addItemToDomainList(aListBox, str);
+    for (let str of aPrefString.split(",")) {
+      str = str.replace(/ /g, "");
+      if (str) {
+        this.addItemToDomainList(aListBox, str);
       }
+    }
   },
 
   removeDomains(aHTML) {
     let listbox = aHTML ? this.mHTMLListBox : this.mPlainTextListBox;
 
     let selectedCount = listbox.selectedItems.length;
     for (let i = selectedCount - 1; i >= 0; i--)
       listbox.selectedItems[i].remove();