Bug 1575777 - Fix various issues after linting changes in M-C. rs=bustage-fix, r=jorgk DONTBUILD
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 22 Aug 2019 11:55:03 +0200
changeset 27379 e134101a4ca9a87754a40c2967956792dee48ccb
parent 27378 74c68706469e2b1b862055d6278f4d25e8fbbf8f
child 27380 8b1270a5cecb91583e6ab520feedb8176eda095d
push id16311
push usermozilla@jorgk.com
push dateThu, 22 Aug 2019 09:58:36 +0000
treeherdercomm-central@e134101a4ca9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage-fix, jorgk
bugs1575777
Bug 1575777 - Fix various issues after linting changes in M-C. rs=bustage-fix, r=jorgk DONTBUILD
calendar/base/content/calendar-month-base-view.js
calendar/base/content/calendar-month-view.js
calendar/base/content/calendar-multiday-base-view.js
calendar/base/content/calendar-multiday-view.js
calendar/lightning/content/html-item-editing/react-code.js
calendar/lightning/content/lightning-calendar-properties.js
calendar/providers/caldav/content/caldav-lightning-calendar-properties.js
calendar/test/unit/head_consts.js
mail/base/content/SearchDialog.js
mail/base/content/folderDisplay.js
mail/base/content/mailWindow.js
mail/components/accountcreation/content/sanitizeDatatypes.js
mail/components/accountcreation/content/util.js
mail/components/compose/content/MsgComposeCommands.js
mail/components/im/content/chat-messenger.js
mail/test/mozmill/attachment/test-attachment-menus.js
mailnews/addrbook/content/abMailListDialog.js
mailnews/base/content/subscribe.js
mailnews/base/content/virtualFolderProperties.js
mailnews/base/prefs/content/am-offline.js
mailnews/db/gloda/test/unit/head_gloda.js
mailnews/imap/test/unit/test_imapAutoSync.js
mailnews/mime/jsmime/test/head_xpcshell_glue.js
--- a/calendar/base/content/calendar-month-base-view.js
+++ b/calendar/base/content/calendar-month-base-view.js
@@ -1,13 +1,13 @@
 /* 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/. */
 
-/* global CalendarBaseView, MozElements, MozXULElement, Services, timeIndicator */
+/* global MozElements, MozXULElement, Services, timeIndicator */
 
 "use strict";
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 // Wrap in a block to prevent leaking to window scope.
 {
     /**
--- a/calendar/base/content/calendar-month-view.js
+++ b/calendar/base/content/calendar-month-view.js
@@ -1,13 +1,13 @@
 /* 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/. */
 
-/* globals currentView MozElements MozXULElement onMouseOverItem invokeEventDragSession */
+/* globals MozElements MozXULElement */
 
 /* import-globals-from calendar-ui-utils.js */
 
 "use strict";
 
 // Wrap in a block to prevent leaking to window scope.
 {
     const { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
--- a/calendar/base/content/calendar-multiday-base-view.js
+++ b/calendar/base/content/calendar-multiday-base-view.js
@@ -1,13 +1,13 @@
 /* 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/. */
 
-/* global CalendarBaseView, currentView, getOtherOrientation, MozElements, MozXULElement, Services,
+/* global currentView, getOtherOrientation, MozElements, MozXULElement, Services,
    setAttributeToChildren, setBooleanAttribute, timeIndicator */
 
 "use strict";
 
 // Wrap in a block to prevent leaking to window scope.
 {
     var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
     /**
--- a/calendar/base/content/calendar-multiday-view.js
+++ b/calendar/base/content/calendar-multiday-view.js
@@ -1,13 +1,13 @@
 /* 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/. */
 
-/* globals currentView, MozElements, MozXULElement, onMouseOverItem */
+/* globals MozElements, MozXULElement, onMouseOverItem */
 
 /* import-globals-from calendar-ui-utils.js */
 
 "use strict";
 
 // Wrap in a block to prevent leaking to window scope.
 {
     const { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
--- a/calendar/lightning/content/html-item-editing/react-code.js
+++ b/calendar/lightning/content/html-item-editing/react-code.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/. */
 
 // This file contains code that uses react.js
 
-/* exported gTopComponent, DatePicker, TopComponent */
+/* exported gTopComponent, DatePicker, ReactDOM, TopComponent */
 
 /* import-globals-from ../lightning-item-iframe.js */
 /* globals React, ReactDOM */
 
 var gTopComponent = null;
 
 var Tabstrip = React.createClass({
     handleChange: function(index) {
--- a/calendar/lightning/content/lightning-calendar-properties.js
+++ b/calendar/lightning/content/lightning-calendar-properties.js
@@ -6,17 +6,17 @@
 
 /* import-globals-from ../../base/content/dialogs/calendar-properties-dialog.js */
 /* import-globals-from lightning-utils.js */
 
 var common_onLoad = onLoad;
 var common_onAcceptDialog = onAcceptDialog;
 
 onLoad = function() {
-    gCalendar = window.arguments[0].calendar;
+    gCalendar = window.arguments[0].calendar; // eslint-disable-line no-global-assign
     ltnInitMailIdentitiesRow();
     ltnNotifyOnIdentitySelection();
     common_onLoad();
 };
 
 onAcceptDialog = function() {
     ltnSaveMailIdentitySelection();
     return common_onAcceptDialog();
--- a/calendar/providers/caldav/content/caldav-lightning-calendar-properties.js
+++ b/calendar/providers/caldav/content/caldav-lightning-calendar-properties.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* import-globals-from ../../../lightning/content/lightning-calendar-properties.js */
 /* import-globals-from caldav-lightning-utils.js */
 
 var ltn_onChangeIdentity = onChangeIdentity;
 
 onLoad = function() {
-    gCalendar = window.arguments[0].calendar;
+    gCalendar = window.arguments[0].calendar; // eslint-disable-line no-global-assign
     ltnInitMailIdentitiesRow();
     caldavInitForceEmailScheduling();
     common_onLoad();
 };
 
 onAcceptDialog = function() {
     ltnSaveMailIdentitySelection();
     caldavSaveForceEmailScheduling();
--- a/calendar/test/unit/head_consts.js
+++ b/calendar/test/unit/head_consts.js
@@ -5,19 +5,18 @@
 /* exported do_calendar_startup, do_load_calmgr, do_load_timezoneservice, readJSONFile,
  *          ics_unfoldline, dedent, compareItemsSpecific, getStorageCal, getMemoryCal,
  *          createTodoFromIcalString, createEventFromIcalString, createDate, Cc, Ci, Cr, Cu
  */
 
 var { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
-var { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
-var { getAppInfo, newAppInfo, updateAppInfo } = ChromeUtils.import("resource://testing-common/AppInfo.jsm");
+var { updateAppInfo } = ChromeUtils.import("resource://testing-common/AppInfo.jsm");
 
 ChromeUtils.defineModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm");
 
 updateAppInfo();
 
 (function() {
     let manager = Cc["@mozilla.org/component-manager-extra;1"].getService(Ci.nsIComponentManagerExtra);
 
--- a/mail/base/content/SearchDialog.js
+++ b/mail/base/content/SearchDialog.js
@@ -218,16 +218,17 @@ SearchFolderDisplayWidget.prototype = {
   },
 };
 
 
 function searchOnLoad() {
   TagUtils.loadTagsIntoCSS(document);
   initializeSearchWidgets();
   initializeSearchWindowWidgets();
+  // eslint-disable-next-line no-global-assign
   messenger = Cc["@mozilla.org/messenger;1"]
                 .createInstance(Ci.nsIMessenger);
 
   gSearchBundle = document.getElementById("bundle_search");
   gSearchStopButton.setAttribute("label", gSearchBundle.getString("labelForSearchButton"));
   gSearchStopButton.setAttribute("accesskey", gSearchBundle.getString("labelForSearchButton.accesskey"));
 
   gMessageDisplay = new NeverVisibleMessageDisplayWidget();
@@ -271,16 +272,17 @@ function searchOnUnload() {
   msgWindow.rootDocShell = null;
 }
 
 function initializeSearchWindowWidgets() {
   gFolderPicker = document.getElementById("searchableFolders");
   gSearchStopButton = document.getElementById("search-button");
   hideMatchAllItem();
 
+  // eslint-disable-next-line no-global-assign
   msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
                 .createInstance(Ci.nsIMsgWindow);
   msgWindow.domWindow = window;
   msgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
 
   gStatusFeedback = new nsMsgStatusFeedback();
   msgWindow.statusFeedback = gStatusFeedback;
 
--- a/mail/base/content/folderDisplay.js
+++ b/mail/base/content/folderDisplay.js
@@ -923,17 +923,17 @@ FolderDisplayWidget.prototype = {
     this.messageDisplay.onCreatedView();
 
     FolderDisplayListenerManager._fireListeners("onCreatedView",
                                                 [this]);
 
     this._notifyWhenActive(this._activeCreatedView);
   },
   _activeCreatedView() {
-    gDBView = this.view.dbView;
+    gDBView = this.view.dbView; // eslint-disable-line no-global-assign
 
     // A change in view may result in changes to sorts, the view menu, etc.
     // Do this before we 'reroot' the dbview.
     this._updateThreadDisplay();
 
     // this creates a new selection object for the view.
     if (this.tree)
       this.tree.view = this.view.dbView;
@@ -965,17 +965,17 @@ FolderDisplayWidget.prototype = {
         // persist any selections.
         if (aFolderIsComingBack && !this._aboutToSelectMessage)
           this._saveSelection();
         else
           this._clearSavedSelection();
       } catch (ex) {
         logException(ex);
       }
-      gDBView = null;
+      gDBView = null; // eslint-disable-line no-global-assign
     }
 
     FolderDisplayListenerManager._fireListeners("onDestroyingView",
                                                 [this, aFolderIsComingBack]);
 
     // if we have no view, no messages could be loaded.
     this._allMessagesLoaded = false;
 
@@ -1587,20 +1587,20 @@ FolderDisplayWidget.prototype = {
    *  linking us up to the UI widgets.  This is intended for use by the tabbing
    *  logic.
    */
   makeActive(aWasInactive) {
     let wasInactive = !this._active;
 
     // -- globals
     // update per-tab globals that we own
-    gFolderDisplay = this;
+    gFolderDisplay = this; // eslint-disable-line no-global-assign
     gMessageDisplay = this.messageDisplay;
-    gDBView = this.view.dbView;
-    messenger = this.messenger;
+    gDBView = this.view.dbView; // eslint-disable-line no-global-assign
+    messenger = this.messenger; // eslint-disable-line no-global-assign
 
     // update singleton globals' state
     msgWindow.openFolder = this.view.displayedFolder;
 
     // This depends on us being active, so get it before we're marked active.
     // We don't get this._folderPaneActive directly for idempotence's sake.
     let folderPaneVisible = this.folderPaneVisible;
 
--- a/mail/base/content/mailWindow.js
+++ b/mail/base/content/mailWindow.js
@@ -53,17 +53,17 @@ function OnMailWindowUnload() {
   // the tabs have the FolderDisplayWidget close their 'messenger' instances for us
 
   window.browserDOMWindow = null;
 
   msgWindow.closeWindow();
 
   msgWindow.msgHeaderSink = null;
   msgWindow.notificationCallbacks = null;
-  gDBView = null;
+  gDBView = null; // eslint-disable-line no-global-assign
   window.MsgStatusFeedback.unload();
   Cc["@mozilla.org/activity-manager;1"]
     .getService(Ci.nsIActivityManager)
     .removeListener(window.MsgStatusFeedback);
 }
 
 
 /**
@@ -153,16 +153,17 @@ function onCopyOrDragStart(e) {
   } else if ("dataTransfer" in e) { // drag
     e.dataTransfer.setData("text/html", html);
     e.dataTransfer.setData("text/plain", plain);
   }
 }
 
 function CreateMailWindowGlobals() {
   // get the messenger instance
+  // eslint-disable-next-line no-global-assign
   messenger = Cc["@mozilla.org/messenger;1"]
                 .createInstance(Ci.nsIMessenger);
 
   window.addEventListener("blur", appIdleManager.onBlur);
   window.addEventListener("focus", appIdleManager.onFocus);
 
   // Create windows status feedback
   // set the JS implementation of status feedback before creating the c++ one..
@@ -180,16 +181,17 @@ function CreateMailWindowGlobals() {
                      .createInstance(Ci.nsIMsgStatusFeedback);
   statusFeedback.setWrappedStatusFeedback(window.MsgStatusFeedback);
 
   Cc["@mozilla.org/activity-manager;1"]
     .getService(Ci.nsIActivityManager)
     .addListener(window.MsgStatusFeedback);
 
   // Create message window object
+  // eslint-disable-next-line no-global-assign
   msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
                 .createInstance(Ci.nsIMsgWindow);
 
   accountManager = MailServices.accounts;
 
   msgWindow.notificationCallbacks = new BadCertHandler();
 }
 
--- a/mail/components/accountcreation/content/sanitizeDatatypes.js
+++ b/mail/components/accountcreation/content/sanitizeDatatypes.js
@@ -1,15 +1,14 @@
 /* -*- 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 emailWizard.js */
-/* globals cleanUpHostName, isLegalHostNameOrIP */
 var {cleanUpHostName, isLegalHostNameOrIP} = ChromeUtils.import("resource:///modules/hostnameUtils.jsm");
 
 /**
  * This is a generic input validation lib. Use it when you process
  * data from the network.
  *
  * Just a few functions which verify, for security purposes, that the
  * input variables (strings, if nothing else is noted) are of the expected
--- a/mail/components/accountcreation/content/util.js
+++ b/mail/components/accountcreation/content/util.js
@@ -48,44 +48,39 @@ function makeNSIURI(uriStr) {
 /**
  * Reads UTF8 data from a URL.
  *
  * @param uri {nsIURI}   what you want to read
  * @return {Array of String}   the contents of the file, one string per line
  */
 function readURLasUTF8(uri) {
   assert(uri instanceof Ci.nsIURI, "uri must be an nsIURI");
-  try {
-    let chan = Services.io.newChannelFromURI(uri,
-                                             null,
-                                             Services.scriptSecurityManager.getSystemPrincipal(),
-                                             null,
-                                             Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-                                             Ci.nsIContentPolicy.TYPE_OTHER);
-    let is = Cc["@mozilla.org/intl/converter-input-stream;1"]
-             .createInstance(Ci.nsIConverterInputStream);
-    is.init(chan.open(), "UTF-8", 1024,
-            Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
+  let chan = Services.io.newChannelFromURI(uri,
+                                           null,
+                                           Services.scriptSecurityManager.getSystemPrincipal(),
+                                           null,
+                                           Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+                                           Ci.nsIContentPolicy.TYPE_OTHER);
+  let is = Cc["@mozilla.org/intl/converter-input-stream;1"]
+           .createInstance(Ci.nsIConverterInputStream);
+  is.init(chan.open(), "UTF-8", 1024,
+          Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
 
-    let content = "";
-    let strOut = {};
-    try {
-      while (is.readString(1024, strOut) != 0)
-        content += strOut.value;
-    // catch in outer try/catch
-    } finally {
-      is.close();
-    }
+  let content = "";
+  let strOut = {};
+  try {
+    while (is.readString(1024, strOut) != 0)
+      content += strOut.value;
+  } finally {
+    is.close();
+  }
 
-    return content;
-  } catch (e) {
-    // TODO this has a numeric error message. We need to ship translations
-    // into human language.
-    throw e;
-  }
+  return content;
+  // TODO this has a numeric error message. We need to ship translations
+  // into human language.
 }
 
 /**
  * Takes a string (which is typically the content of a file,
  * e.g. the result returned from readURLUTF8() ), and splits
  * it into lines, and returns an array with one string per line
  *
  * Linebreaks are not contained in the result,,
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -132,31 +132,33 @@ function InitializeGlobalVariables() {
   gLanguageObserver = null;
 
   gLastWindowToHaveFocus = null;
   gReceiptOptionChanged = false;
   gDSNOptionChanged = false;
   gAttachVCardOptionChanged = false;
   gAttachmentsSize = 0;
   gNumUploadingAttachments = 0;
+  // eslint-disable-next-line no-global-assign
   msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
                 .createInstance(Ci.nsIMsgWindow);
   MailServices.mailSession.AddMsgWindow(msgWindow);
 }
 InitializeGlobalVariables();
 
 function ReleaseGlobalVariables() {
   gCurrentIdentity = null;
   gCharsetConvertManager = null;
   gMsgCompose = null;
   gOriginalMsgURI = null;
   gMessenger = null;
   gDisableAttachmentReminder = false;
   _gComposeBundle = null;
   MailServices.mailSession.RemoveMsgWindow(msgWindow);
+  // eslint-disable-next-line no-global-assign
   msgWindow = null;
 }
 
 // Notification box shown at the bottom of the window.
 var gNotification = {};
 XPCOMUtils.defineLazyGetter(gNotification, "notificationbox", () => {
   return new MozElements.NotificationBox(element => {
     element.setAttribute("flex", "1");
--- a/mail/components/im/content/chat-messenger.js
+++ b/mail/components/im/content/chat-messenger.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/. */
 
 /* global MozElements MozXULElement */
 /* import-globals-from ../../../../../toolkit/content/globalOverlay.js */
 
 // This file is loaded in messenger.xul.
-/* globals fixIterator, MailToolboxCustomizeDone, Notifications, openIMAccountMgr,
+/* globals fixIterator, MailToolboxCustomizeDone, openIMAccountMgr,
    PROTO_TREE_VIEW, Services, Status, statusSelector, ZoomManager */
 
 var {Notifications} = ChromeUtils.import("resource:///modules/chatNotifications.jsm");
 var { Services: imServices } = ChromeUtils.import("resource:///modules/imServices.jsm");
 var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 var {InlineSpellChecker} = ChromeUtils.import("resource://gre/modules/InlineSpellChecker.jsm");
 
 ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
--- a/mail/test/mozmill/attachment/test-attachment-menus.js
+++ b/mail/test/mozmill/attachment/test-attachment-menus.js
@@ -306,18 +306,16 @@ function check_toolbar_menu_states_singl
       querySelector(".toolbarbutton-menubutton-dropmarker")));
     wait_for_popup_to_open(mc.e("attachmentSaveAllSingleMenu"));
 
     try {
       assert_enabled("button-openAttachment", expected.open);
       assert_enabled("button-saveAttachment", expected.save);
       assert_enabled("button-detachAttachment", expected.detach);
       assert_enabled("button-deleteAttachment", expected.delete_);
-    } catch (e) {
-      throw e;
     } finally {
       close_popup(mc, mc.eid("attachmentSaveAllSingleMenu"));
     }
   }
 }
 
 /**
  * Check that the menu states in the "save all" toolbar button are correct.
@@ -336,18 +334,16 @@ function check_toolbar_menu_states_multi
       querySelector(".toolbarbutton-menubutton-dropmarker")));
     wait_for_popup_to_open(mc.e("attachmentSaveAllMultipleMenu"));
 
     try {
       assert_enabled("button-openAllAttachments", expected.open);
       assert_enabled("button-saveAllAttachments", expected.save);
       assert_enabled("button-detachAllAttachments", expected.detach);
       assert_enabled("button-deleteAllAttachments", expected.delete_);
-    } catch (e) {
-      throw e;
     } finally {
       close_popup(mc, mc.eid("attachmentSaveAllMultipleMenu"));
     }
   }
 }
 
 /**
  * Check that the menu states in the single item context menu are correct
@@ -369,18 +365,16 @@ function check_menu_states_single(index,
     assert_shown("context-menu-separator", true);
     assert_shown("context-detachAttachment", true);
     assert_shown("context-deleteAttachment", true);
 
     assert_enabled("context-openAttachment", expected.open);
     assert_enabled("context-saveAttachment", expected.save);
     assert_enabled("context-detachAttachment", expected.detach);
     assert_enabled("context-deleteAttachment", expected.delete_);
-  } catch (e) {
-    throw e;
   } finally {
     menu.close();
   }
 }
 
 /**
  * Check that the menu states in the all items context menu are correct
  *
@@ -399,18 +393,16 @@ function check_menu_states_all(expected)
     assert_shown("context-menu-separator-all", true);
     assert_shown("context-detachAllAttachments", true);
     assert_shown("context-deleteAllAttachments", true);
 
     assert_enabled("context-openAllAttachments", expected.open);
     assert_enabled("context-saveAllAttachments", expected.save);
     assert_enabled("context-detachAllAttachments", expected.detach);
     assert_enabled("context-deleteAllAttachments", expected.delete_);
-  } catch (e) {
-    throw e;
   } finally {
     close_popup(mc, mc.eid("attachmentListContext"));
   }
 }
 
 function help_test_attachment_menus(index) {
   be_in_folder(folder);
   select_click_row(index);
--- a/mailnews/addrbook/content/abMailListDialog.js
+++ b/mailnews/addrbook/content/abMailListDialog.js
@@ -256,17 +256,16 @@ function OnLoadEditList() {
     // Getting a sane read-only implementation for the addressing widget would
     // basically need a separate dialog. Given I'm not sure about the future of
     // the mailing list dialog in its current state, let's just disable it
     // completely.
     document.getElementById("addressingWidget").disabled = true;
   }
 
   if (AppConstants.MOZ_APP_NAME == "seamonkey") {
-    /* global awDocumentKeyPress */
     document.addEventListener("keypress", awDocumentKeyPress, true);
   }
 
   // workaround for bug 118337 - for mailing lists that have more rows than fits inside
   // the display, the value of the textbox inside the new row isn't inherited into the input -
   // the first row then appears to be duplicated at the end although it is actually empty.
   // see awAppendNewRow which copies first row and clears it
   setTimeout(AppendLastRow, 0);
--- a/mailnews/base/content/subscribe.js
+++ b/mailnews/base/content/subscribe.js
@@ -140,16 +140,17 @@ function SubscribeOnLoad() {
   gSubscribeBody = document.getElementById("subscribeTreeBody");
   gSearchTree = document.getElementById("searchTree");
   gSearchTree = document.getElementById("searchTree");
   gNameField = document.getElementById("namefield");
   gNameFieldLabel = document.getElementById("namefieldlabel");
 
   gSubscribeDeck = document.getElementById("subscribedeck");
 
+  // eslint-disable-next-line no-global-assign
   msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
                 .createInstance(Ci.nsIMsgWindow);
   msgWindow.domWindow = window;
   gStatusFeedback = new nsMsgStatusFeedback;
   msgWindow.statusFeedback = gStatusFeedback;
   msgWindow.rootDocShell.allowAuth = true;
   msgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
 
--- a/mailnews/base/content/virtualFolderProperties.js
+++ b/mailnews/base/content/virtualFolderProperties.js
@@ -27,17 +27,17 @@ document.addEventListener("dialogaccept"
 
 function onLoad() {
   var windowArgs = window.arguments[0];
   var acceptButton = document.documentElement.getButton("accept");
 
   gMessengerBundle = document.getElementById("bundle_messenger");
 
   // call this when OK is pressed
-  msgWindow = windowArgs.msgWindow;
+  msgWindow = windowArgs.msgWindow; // eslint-disable-line no-global-assign
 
   initializeSearchWidgets();
 
   setSearchScope(nsMsgSearchScope.offlineMail);
   if (windowArgs.editExistingFolder) {
     acceptButton.label =
         document.documentElement.getAttribute("editFolderAcceptButtonLabel");
     acceptButton.accesskey =
--- a/mailnews/base/prefs/content/am-offline.js
+++ b/mailnews/base/prefs/content/am-offline.js
@@ -8,17 +8,17 @@
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var {fixIterator} = ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 
 var gIncomingServer;
 var gServerType;
 var gImapIncomingServer;
 var gPref = null;
-var gLockedPref = null;
+var gLockedPref = {};
 var gOfflineMap = null; // map of folder URLs to offline flags
 var gOfflineFolders;    // initial state of allFoldersOffline checkbox
 var gToggleOccurred = false;
 
 function onInit(aPageId, aServerId) {
   onLockPreference();
 
   // init values here
@@ -268,19 +268,16 @@ function onSave() {
     gImapIncomingServer.offlineDownload = document.getElementById("offline.folders").checked;
   }
 }
 
 // Does the work of disabling an element given the array which contains xul id/prefstring pairs.
 // Also saves the id/locked state in an array so that other areas of the code can avoid
 // stomping on the disabled state indiscriminately.
 function disableIfLocked(prefstrArray) {
-  if (!gLockedPref)
-    gLockedPref = [];
-
   for (let i = 0; i < prefstrArray.length; i++) {
     var id = prefstrArray[i].id;
     var element = document.getElementById(id);
     if (gPref.prefIsLocked(prefstrArray[i].prefstring)) {
       element.disabled = true;
       gLockedPref[id] = true;
     } else {
       element.removeAttribute("disabled");
--- a/mailnews/db/gloda/test/unit/head_gloda.js
+++ b/mailnews/db/gloda/test/unit/head_gloda.js
@@ -1,15 +1,11 @@
-var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
-var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+/* exported mailTestUtils */
 var {mailTestUtils} = ChromeUtils.import("resource://testing-common/mailnews/mailTestUtils.js");
 
-var CC = Components.Constructor;
-
 // Ensure the profile directory is set up
 do_get_profile();
 
 var gDEPTH = "../../../../../";
 
 // glodaTestHelper.js does all the rest of the imports
 
 registerCleanupFunction(function() {
--- a/mailnews/imap/test/unit/test_imapAutoSync.js
+++ b/mailnews/imap/test/unit/test_imapAutoSync.js
@@ -162,60 +162,40 @@ var gAutoSyncListener = {
   _runnning: false,
   _lastMessage: {},
   _waitingForUpdateList: [],
   _waitingForUpdate: false,
   _waitingForDiscoveryList: [],
   _waitingForDiscovery: false,
 
   onStateChanged(running) {
-    try {
-      this._runnning = running;
-    } catch (e) {
-      throw (e);
-    }
+    this._runnning = running;
   },
 
   onFolderAddedIntoQ(queue, folder) {
-    try {
-      dump("folder added into Q " + this.qName(queue) + " " + folder.URI + "\n");
-    } catch (e) {
-      throw (e);
-    }
+    dump("folder added into Q " + this.qName(queue) + " " + folder.URI + "\n");
   },
   onFolderRemovedFromQ(queue, folder) {
-    try {
-      dump("folder removed from Q " + this.qName(queue) + " " + folder.URI + "\n");
-    } catch (e) {
-      throw (e);
-    }
+    dump("folder removed from Q " + this.qName(queue) + " " + folder.URI + "\n");
   },
   onDownloadStarted(folder, numOfMessages, totalPending) {
-    try {
-      dump("folder download started" + folder.URI + "\n");
-    } catch (e) {
-      throw (e);
-    }
+    dump("folder download started" + folder.URI + "\n");
   },
 
   onDownloadCompleted(folder) {
-    try {
-      dump("folder download completed" + folder.URI + "\n");
-      if (folder instanceof Ci.nsIMsgFolder) {
-        let index = mailTestUtils.non_strict_index_of(this._waitingForUpdateList, folder);
-        if (index != -1)
-          this._waitingForUpdateList.splice(index, 1);
-        if (this._waitingForUpdate && this._waitingForUpdateList.length == 0) {
-          dump("got last folder update looking for\n");
-          this._waitingForUpdate = false;
-          async_driver();
-        }
+    dump("folder download completed" + folder.URI + "\n");
+    if (folder instanceof Ci.nsIMsgFolder) {
+      let index = mailTestUtils.non_strict_index_of(this._waitingForUpdateList, folder);
+      if (index != -1)
+        this._waitingForUpdateList.splice(index, 1);
+      if (this._waitingForUpdate && this._waitingForUpdateList.length == 0) {
+        dump("got last folder update looking for\n");
+        this._waitingForUpdate = false;
+        async_driver();
       }
-    } catch (e) {
-      throw (e);
     }
   },
 
   onDownloadError(folder) {
     if (folder instanceof Ci.nsIMsgFolder) {
       dump("OnDownloadError: " + folder.prettyName + "\n");
     }
   },
--- a/mailnews/mime/jsmime/test/head_xpcshell_glue.js
+++ b/mailnews/mime/jsmime/test/head_xpcshell_glue.js
@@ -72,16 +72,17 @@ function innerDefine(moduleName, dfn) {
     if (path.startsWith("./"))
       path = path.substring(2);
     return require(path);
   }
   var result = dfn(resolvingRequire);
   requireCache.set(moduleName, result);
 }
 
+/* exported define */
 var define = innerDefine.bind(this, "xpcshell-test");
 
 // Mocha TDD UI Bindings
 // ---------------------
 
 /**
  * A block of tests, from the suite class.
  */
@@ -134,16 +135,17 @@ function runFunction(fn) {
       // Promise.resolve nicely handles both promises and not-promise values for
       // us.
       resolve(fn());
     }
   });
   return completed;
 }
 
+/* exported suite, test, setup, teardown, run_test */
 var currentSuite = new MochaSuite("");
 function suite(name, tests) {
   name = name.toString();
   if (/[\x80-]/.exec(name))
     name = "<unprintable name>";
   let suiteParent = currentSuite;
   currentSuite = new MochaSuite(name);
   suiteParent.suites.push(currentSuite);