Bug 1515877 - Turn on ESLint in mailnews/test/resources draft
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 28 Feb 2019 21:50:39 +1300
changeset 71354 fa379e99446817d7006d94018ac63ee3ffe0df99
parent 71351 e4e1375d72d804a85824543e0b0bcc9d4c14f2fb
child 71355 8c1f2819e0fd4ff9d927a7b4fdf5bcbf557fc04c
push id7877
push usergeoff@darktrojan.net
push dateThu, 28 Feb 2019 08:53:29 +0000
treeherdertry-comm-central@15cee7c97ceb [default view] [failures only]
bugs1515877
Bug 1515877 - Turn on ESLint in mailnews/test/resources
.eslintignore
mailnews/base/test/unit/test_nsIMsgFolderListenerLocal.js
mailnews/imap/test/unit/test_nsIMsgFolderListenerIMAP.js
mailnews/test/resources/.eslintrc.js
mailnews/test/resources/IMAPpump.js
mailnews/test/resources/MockFactory.js
mailnews/test/resources/NetworkTestUtils.jsm
mailnews/test/resources/POP3pump.js
mailnews/test/resources/PromiseTestUtils.jsm
mailnews/test/resources/abSetup.js
mailnews/test/resources/alertTestUtils.js
mailnews/test/resources/asyncTestUtils.js
mailnews/test/resources/filterTestUtils.js
mailnews/test/resources/folderEventLogHelper.js
mailnews/test/resources/localAccountUtils.js
mailnews/test/resources/logHelper.js
mailnews/test/resources/mailShutdown.js
mailnews/test/resources/mailTestUtils.js
mailnews/test/resources/messageGenerator.js
mailnews/test/resources/messageInjection.js
mailnews/test/resources/messageModifier.js
mailnews/test/resources/msgFolderListenerSetup.js
mailnews/test/resources/passwordStorage.js
mailnews/test/resources/searchTestUtils.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -32,17 +32,17 @@ mailnews/base/*
 mailnews/build/*
 mailnews/compose/*
 mailnews/db/*
 mailnews/imap/*
 mailnews/import/*
 mailnews/intl/*
 mailnews/jsaccount/*
 mailnews/mime/*
-mailnews/test/*
+mailnews/test/fakeserver/*
 
 # mailnews/extensions exclusions
 mailnews/extensions/*
 !mailnews/extensions/newsblog
 
 # mail exclusions
 mail/app/profile/all-thunderbird.js
 mail/app/profile/channel-prefs.js
--- a/mailnews/base/test/unit/test_nsIMsgFolderListenerLocal.js
+++ b/mailnews/base/test/unit/test_nsIMsgFolderListenerLocal.js
@@ -46,46 +46,46 @@ function addFolder(parent, folderName, s
  * classification because no messages have yet been marked as junk and there
  * are no traits configured, aJunkProcessed and aTraitProcessed will be false.
  */
 function copyFileMessage(file, destFolder, isDraftOrTemplate)
 {
   copyListener.mFolderStoredIn = destFolder;
   gExpectedEvents = [[MailServices.mfn.msgAdded, gHdrsReceived],
                      [MailServices.mfn.msgsClassified, gHdrsReceived, false, false]];
-  gCopyService.CopyFileMessage(file, destFolder, null, isDraftOrTemplate, 0, "",
-                               copyListener, null);
+  MailServices.copy.CopyFileMessage(file, destFolder, null, isDraftOrTemplate, 0, "",
+                                    copyListener, null);
   gCurrStatus |= kStatus.functionCallDone;
   if (gCurrStatus == kStatus.everythingDone)
     resetStatusAndProceed();
 }
 
 function copyMessages(items, isMove, srcFolder, destFolder)
 {
   var array = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
   items.forEach(function (item) {
     array.appendElement(item);
   });
   gExpectedEvents = [
     [MailServices.mfn.msgsMoveCopyCompleted, isMove, items, destFolder, true]];
-  gCopyService.CopyMessages(srcFolder, array, destFolder, isMove, copyListener,
-                            null, true);
+  MailServices.copy.CopyMessages(srcFolder, array, destFolder, isMove, copyListener,
+                                 null, true);
   gCurrStatus |= kStatus.functionCallDone;
   if (gCurrStatus == kStatus.everythingDone)
     resetStatusAndProceed();
 }
 
 function copyFolders(items, isMove, destFolder)
 {
   var array = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
   items.forEach(function (item) {
     array.appendElement(item);
   });
   gExpectedEvents = [[MailServices.mfn.folderMoveCopyCompleted, isMove, items, destFolder]];
-  gCopyService.CopyFolders(array, destFolder, isMove, copyListener, null);
+  MailServices.copy.CopyFolders(array, destFolder, isMove, copyListener, null);
   gCurrStatus |= kStatus.functionCallDone;
   if (gCurrStatus == kStatus.everythingDone)
     resetStatusAndProceed();
 }
 
 function deleteMessages(srcFolder, items, deleteStorage, isMove)
 {
   var array = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
--- a/mailnews/imap/test/unit/test_nsIMsgFolderListenerIMAP.js
+++ b/mailnews/imap/test/unit/test_nsIMsgFolderListenerIMAP.js
@@ -64,17 +64,17 @@ function copyFileMessage(file, messageId
   // message header, and fakeserver doesn't implement it yet. So get it to fail
   // earlier by *not* sending the message id.
   // copyListener.mMessageId = messageId;
 
   // Instead store the message id in gExpectedEvents, so we can match that up
   gExpectedEvents = [[MailServices.mfn.msgAdded, {expectedMessageId: messageId}],
                      [MailServices.mfn.msgsClassified, [messageId], false, false]];
   destFolder.updateFolder(null);
-  gCopyService.CopyFileMessage(file, destFolder, null, true, 0, "", copyListener, null);
+  MailServices.copy.CopyFileMessage(file, destFolder, null, true, 0, "", copyListener, null);
   gCurrStatus |= kStatus.functionCallDone;
   gServer.performTest("APPEND");
   // Allow some time for the append operation to complete, so update folder
   // every second
   gFolderBeingUpdated = destFolder;
   doUpdateFolder(gTest);
 }
 
@@ -133,17 +133,17 @@ function copyMessages(messages, isMove, 
     gExpectedEvents.push([MailServices.mfn.msgKeyChanged,
                           {expectedMessageId: message.messageId}]);
     gExpectedEvents.push([MailServices.mfn.msgAdded,
                           {expectedMessageId: message.messageId}]);
   });
   gExpectedEvents.push([MailServices.mfn.msgsClassified,
                         messages.map(hdr => hdr.messageId),
                         false, false]);
-  gCopyService.CopyMessages(srcFolder, array, destFolder, isMove, copyListener, gMsgWindow, true);
+  MailServices.copy.CopyMessages(srcFolder, array, destFolder, isMove, copyListener, gMsgWindow, true);
   gCurrStatus |= kStatus.functionCallDone;
 
   gServer.performTest("COPY");
 
   gFolderBeingUpdated = destFolder;
   doUpdateFolder(gTest);
   if (gCurrStatus == kStatus.everythingDone)
     resetStatusAndProceed();
new file mode 100644
--- /dev/null
+++ b/mailnews/test/resources/.eslintrc.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = {
+  "extends": "plugin:mozilla/xpcshell-test",
+};
--- a/mailnews/test/resources/IMAPpump.js
+++ b/mailnews/test/resources/IMAPpump.js
@@ -1,25 +1,25 @@
 /* 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/. */
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * This file provides a simple interface to the imap fake server. Demonstration
  *  of its use can be found in test_imapPump.js
  *
  * The code that forms the core of this file, in its original incarnation,
  *  was test_imapFolderCopy.js  There have been several iterations since
  *  then.
  */
 
 var EXPORTED_SYMBOLS = [
-  'IMAPPump',
-  'setupIMAPPump',
-  'teardownIMAPPump'
+  "IMAPPump",
+  "setupIMAPPump",
+  "teardownIMAPPump",
 ];
 
 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");
 var {localAccountUtils} = ChromeUtils.import("resource://testing-common/mailnews/localAccountUtils.js");
 var {gThreadManager, nsMailServer} = ChromeUtils.import("resource://testing-common/mailnews/maild.js");
 var {
@@ -32,21 +32,20 @@ ChromeUtils.import("resource://testing-c
 var {updateAppInfo} = ChromeUtils.import("resource://testing-common/AppInfo.jsm");
 
 // define globals
 var IMAPPump = {
   daemon: null,         // the imap fake server daemon
   server: null,         // the imap fake server
   incomingServer: null, // nsIMsgIncomingServer for the imap server
   inbox: null,          // nsIMsgFolder/nsIMsgImapMailFolder for imap inbox
-  mailbox: null         // imap fake server mailbox
+  mailbox: null,        // imap fake server mailbox
 };
 
-function setupIMAPPump(extensions)
-{
+function setupIMAPPump(extensions) {
   // Create Application info if we need it.
   updateAppInfo();
 
   // These are copied from imap's head_server.js to here so we can run
   //   this from any directory.
   function makeServer(daemon, infoString) {
     if (infoString in imapd.configurations)
       return makeServer(daemon, imapd.configurations[infoString].join(","));
@@ -111,27 +110,25 @@ function setupIMAPPump(extensions)
   IMAPPump.incomingServer.performExpand(null);
 
   IMAPPump.inbox = IMAPPump.incomingServer.rootFolder.getChildNamed("INBOX");
   IMAPPump.mailbox = IMAPPump.daemon.getMailbox("INBOX");
   IMAPPump.inbox instanceof Ci.nsIMsgImapMailFolder;
 }
 
 // This will clear not only the imap accounts but also local accounts.
-function teardownIMAPPump()
-{
+function teardownIMAPPump() {
   // try to finish any pending operations
   let thread = gThreadManager.currentThread;
   while (thread.hasPendingEvents())
     thread.processNextEvent(true);
 
   IMAPPump.inbox = null;
   try {
     let serverSink = IMAPPump.incomingServer.QueryInterface(Ci.nsIImapServerSink);
     serverSink.abortQueuedUrls();
     IMAPPump.incomingServer.closeCachedConnections();
     IMAPPump.server.resetTest();
     IMAPPump.server.stop();
     MailServices.accounts.removeIncomingServer(IMAPPump.incomingServer, false);
     localAccountUtils.clearAll();
-  } catch (ex) {dump(ex);}
-
+  } catch (ex) { dump(ex); }
 }
--- a/mailnews/test/resources/MockFactory.js
+++ b/mailnews/test/resources/MockFactory.js
@@ -1,8 +1,12 @@
+/* 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.EXPORTED_SYMBOLS = ["MockFactory"];
 
 var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 var Cm = Components.manager;
 
 var MockFactory = {
   _registeredComponents: {},
@@ -13,27 +17,27 @@ var MockFactory = {
    * @param contractID The contract ID of the interface which is overridden by
                        the mock.
    *                   e.g. "@mozilla.org/messenger/account-manager;1"
    * @param mock An object which implements interfaces for the contract ID.
    * @param args       An array which is passed in the constructor of mock.
    *
    * @return           The UUID of the mock.
    */
-  register: function(contractID, mock, args) {
+  register(contractID, mock, args) {
     let uuid = Cc["@mozilla.org/uuid-generator;1"]
                  .getService(Ci.nsIUUIDGenerator)
                  .generateUUID()
                  .toString();
 
     let originalCID = Cm.nsIComponentRegistrar.contractIDToCID(contractID);
     let originalFactory = Cm.getClassObject(Cc[contractID], Ci.nsIFactory);
 
     let factory = {
-      createInstance: function(outer, iid) {
+      createInstance(outer, iid) {
         if (outer)
           do_throw(Cr.NS_ERROR_NO_AGGREGATION);
 
         let wrappedMock;
         if (mock.prototype && mock.prototype.constructor)
           wrappedMock = new (mock.bind(null, args));
         else
           wrappedMock = mock;
@@ -41,55 +45,55 @@ var MockFactory = {
         /*
          * Some interfaces fail to be created an instance since
          * the interface is not registered in xpcshell tests.
          * ex. nsIXULAppInfo.
          */
         try {
           let genuine = originalFactory.createInstance(outer, iid);
           wrappedMock._genuine = genuine;
-        } catch(ex) {
+        } catch (ex) {
           dump(ex);
         }
 
         return wrappedMock.QueryInterface(iid);
       },
-      QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory])
+      QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),
     };
 
     Cm.QueryInterface(Ci.nsIComponentRegistrar)
       .registerFactory(Components.ID(uuid),
                        "A Mock for " + contractID,
                        contractID, factory);
 
     this._registeredComponents[uuid] = {
-      contractID: contractID,
-      originalCID: originalCID,
-      factory: factory
+      contractID,
+      originalCID,
+      factory,
     };
 
     return uuid;
   },
 
   /**
    * Unregister the mock.
    *
    * @param uuid The UUID of the mock.
    */
-  unregister: function(uuid) {
+  unregister(uuid) {
     if (!this._registeredComponents[uuid])
       return;
 
     Cm.QueryInterface(Ci.nsIComponentRegistrar)
       .unregisterFactory(Components.ID(uuid),
                          this._registeredComponents[uuid].factory);
     Cm.QueryInterface(Ci.nsIComponentRegistrar)
       .registerFactory(this._registeredComponents[uuid].originalCID, "",
                        this._registeredComponents[uuid].contractID, null);
 
     delete this._registeredComponents[uuid];
   },
 
-  unregisterAll: function() {
+  unregisterAll() {
     for (let uuid in this._registeredComponents)
       this.unregister(uuid);
-  }
+  },
 };
--- a/mailnews/test/resources/NetworkTestUtils.jsm
+++ b/mailnews/test/resources/NetworkTestUtils.jsm
@@ -1,26 +1,23 @@
 /* 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/. */
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * This file provides utilities useful in testing more advanced networking
  * scenarios, such as proxies and SSL connections.
  */
 
-this.EXPORTED_SYMBOLS = ['NetworkTestUtils'];
+this.EXPORTED_SYMBOLS = ["NetworkTestUtils"];
 
 var CC = Components.Constructor;
 
 const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
-var {Promise} = ChromeUtils.import("resource://gre/modules/Promise.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 const ServerSocket = CC("@mozilla.org/network/server-socket;1",
                         "nsIServerSocket",
                         "init");
 const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
                              "nsIBinaryInputStream",
                              "setInputStream");
 
@@ -66,78 +63,75 @@ SocksClient.prototype = {
         this.handleSocks5Request();
         break;
     }
 
     if (!this.sub_transport)
       this.waitRead(input);
   },
 
-  /// Listen on the input for the next packet
+  // Listen on the input for the next packet
   waitRead(input) {
     input.asyncWait(this, 0, 0, currentThread);
   },
 
-  /// Simple handler to write out a binary string (because xpidl sucks here)
+  // Simple handler to write out a binary string (because xpidl sucks here)
   write(buf) {
     this.client_out.write(buf, buf.length);
   },
 
-  /// Handle the first SOCKSv5 client message
+  // Handle the first SOCKSv5 client message
   handleGreeting() {
     if (this.inbuf.length == 0)
       return;
 
     if (this.inbuf[0] != 5) {
-      dump("Unknown protocol version: " + this.inbuf[0] + '\n');
+      dump("Unknown protocol version: " + this.inbuf[0] + "\n");
       this.close();
       return;
     }
 
     // Some quality checks to make sure we've read the entire greeting.
     if (this.inbuf.length < 2)
       return;
     var nmethods = this.inbuf[1];
     if (this.inbuf.length < 2 + nmethods)
       return;
-    var methods = this.inbuf.slice(2, 2 + nmethods);
     this.inbuf = [];
 
     // Tell them that we don't log into this SOCKS server.
     this.state = STATE_WAIT_SOCKS5_REQUEST;
-    this.write('\x05\x00');
+    this.write("\x05\x00");
   },
 
-  /// Handle the second SOCKSv5 message
+  // Handle the second SOCKSv5 message
   handleSocks5Request() {
     if (this.inbuf.length < 4)
       return;
 
     // Find the address:port requested.
-    var version = this.inbuf[0];
-    var cmd = this.inbuf[1];
     var atype = this.inbuf[3];
+    var len, addr;
     if (atype == 0x01) { // IPv4 Address
-      var len = 4;
-      var addr = this.inbuf.slice(4, 8).join('.');
+      len = 4;
+      addr = this.inbuf.slice(4, 8).join(".");
     } else if (atype == 0x03) { // Domain name
-      var len = this.inbuf[4];
-      var addr = String.fromCharCode.apply(null,
-        this.inbuf.slice(5, 5 + len));
+      len = this.inbuf[4];
+      addr = String.fromCharCode.apply(null, this.inbuf.slice(5, 5 + len));
       len = len + 1;
     } else if (atype == 0x04) { // IPv6 address
-      var len = 16;
-      var addr = this.inbuf.slice(4, 20).map(i => i.toString(16)).join(':');
+      len = 16;
+      addr = this.inbuf.slice(4, 20).map(i => i.toString(16)).join(":");
     }
     var port = this.inbuf[4 + len] << 8 | this.inbuf[5 + len];
-    dump("Requesting " + addr + ":" + port + '\n');
+    dump("Requesting " + addr + ":" + port + "\n");
 
     // Map that data to the port we report.
     var foundPort = gPortMap.get(addr + ":" + port);
-    dump("This was mapped to " + foundPort + '\n');
+    dump("This was mapped to " + foundPort + "\n");
 
     if (foundPort !== undefined) {
       this.write("\x05\x00\x00" + // Header for response
           "\x04" + "\x00".repeat(15) + "\x01" + // IPv6 address ::1
           String.fromCharCode(foundPort >> 8) +
           String.fromCharCode(foundPort & 0xff) // Port number
       );
     } else {
@@ -161,23 +155,23 @@ SocksClient.prototype = {
     NetUtil.asyncCopy(this.client_in, tunnelOutput);
   },
 
   close() {
     this.client_in.close();
     this.client_out.close();
     if (this.sub_transport)
       this.sub_transport.close(Cr.NS_OK);
-  }
+  },
 };
 
-/// A SOCKS server that runs on a random port.
+// A SOCKS server that runs on a random port.
 function SocksTestServer() {
   this.listener = ServerSocket(-1, true, -1);
-  dump("Starting SOCKS server on " + this.listener.port + '\n');
+  dump("Starting SOCKS server on " + this.listener.port + "\n");
   this.port = this.listener.port;
   this.listener.asyncListen(this);
   this.client_connections = [];
 }
 SocksTestServer.prototype = {
   QueryInterface: ChromeUtils.generateQI([Ci.nsIServerSocketListener]),
 
   onSocketAccepted(socket, trans) {
@@ -192,21 +186,21 @@ SocksTestServer.prototype = {
   close() {
     for (let client of this.client_connections)
       client.close();
     this.client_connections = [];
     if (this.listener) {
       this.listener.close();
       this.listener = null;
     }
-  }
+  },
 };
 
 var gSocksServer = null;
-/// hostname:port -> the port on localhost that the server really runs on.
+// hostname:port -> the port on localhost that the server really runs on.
 var gPortMap = new Map();
 
 var NetworkTestUtils = {
   /**
    * Set up a proxy entry such that requesting a connection to hostName:port
    * will instead cause a connection to localRemappedPort. This will use a SOCKS
    * proxy (because any other mechanism is too complicated). Since this is
    * starting up a server, it does behoove you to call shutdownServers when you
--- a/mailnews/test/resources/POP3pump.js
+++ b/mailnews/test/resources/POP3pump.js
@@ -1,8 +1,12 @@
+/* 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 routine will allow the easy processing of
  * messages through the fake POP3 server into the local
  * folder. It uses a single global defined as:
  *
  *  gPOP3Pump:        the main access to the routine
  *  gPOP3Pump.run()   function to run to load the messages. Returns promise that
  *                    resolves when done.
@@ -15,16 +19,17 @@
  *                                   (in) pluggable store contract ID
  *
  * adapted from test_pop3GetNewMail.js
  *
  * Original Author: Kent James <kent@caspia.com>
  *
  */
 
+var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
 var {localAccountUtils} = ChromeUtils.import("resource://testing-common/mailnews/localAccountUtils.js");
 
 // Import the pop3 server scripts
 var {nsMailServer} = ChromeUtils.import("resource://testing-common/mailnews/maild.js");
 var {
   AuthPLAIN,
   AuthLOGIN,
@@ -33,18 +38,17 @@ var {
 var {
   pop3Daemon,
   POP3_RFC1939_handler,
   POP3_RFC2449_handler,
   POP3_RFC5034_handler,
 } = ChromeUtils.import("resource://testing-common/mailnews/pop3d.js");
 var {Promise} = ChromeUtils.import("resource://gre/modules/Promise.jsm");
 
-function POP3Pump()
-{
+function POP3Pump() {
   // public attributes
   this.fakeServer = null;
   this.onDone = null;
   this.files = null;
 
   // local private variables
 
   this.kPOP3_PORT = 1024 + 110;
@@ -57,65 +61,59 @@ function POP3Pump()
   this._finalCleanup = false;
   this._expectedResult = Cr.NS_OK;
   this._actualResult = Cr.NS_ERROR_UNEXPECTED;
   this._mailboxStoreContractID =
     Services.prefs.getCharPref("mail.serverDefaultStoreContractID");
 }
 
 // nsIUrlListener implementation
-POP3Pump.prototype.OnStartRunningUrl = function OnStartRunningUrl(url) {};
+POP3Pump.prototype.OnStartRunningUrl = function(url) {};
 
-POP3Pump.prototype.OnStopRunningUrl = function OnStopRunningUrl(aUrl, aResult)
-{
+POP3Pump.prototype.OnStopRunningUrl = function(aUrl, aResult) {
   this._actualResult = aResult;
-  if (aResult != Cr.NS_OK)
-  {
+  if (aResult != Cr.NS_OK) {
     // If we have an error, clean up nicely.
     this._server.stop();
 
     var thread = Services.tm.currentThread;
     while (thread.hasPendingEvents())
       thread.processNextEvent(true);
   }
   Assert.equal(aResult, this._expectedResult);
 
   // Let OnStopRunningUrl return cleanly before doing anything else.
   do_timeout(0, _checkPumpBusy);
 };
 
 // Setup the daemon and server
 // If the debugOption is set, then it will be applied to the server.
-POP3Pump.prototype._setupServerDaemon = function _setupServerDaemon(aDebugOption)
-{
+POP3Pump.prototype._setupServerDaemon = function(aDebugOption) {
   this._daemon = new pop3Daemon();
   function createHandler(d) {
     return new POP3_RFC1939_handler(d);
   }
   this._server = new nsMailServer(createHandler, this._daemon);
   if (aDebugOption)
     this._server.setDebugLevel(aDebugOption);
   return [this._daemon, this._server];
 };
 
-POP3Pump.prototype._createPop3ServerAndLocalFolders =
-  function _createPop3ServerAndLocalFolders()
-{
-  if (typeof localAccountUtils.inboxFolder == 'undefined')
+POP3Pump.prototype._createPop3ServerAndLocalFolders = function() {
+  if (typeof localAccountUtils.inboxFolder == "undefined")
     localAccountUtils.loadLocalMailAccount();
 
   if (!this.fakeServer)
     this.fakeServer = localAccountUtils.create_incoming_server("pop3", this.kPOP3_PORT,
                                                                "fred", "wilma");
 
   return this.fakeServer;
 };
 
-POP3Pump.prototype.resetPluggableStore = function(aStoreContractID)
-{
+POP3Pump.prototype.resetPluggableStore = function(aStoreContractID) {
   if (aStoreContractID == this._mailboxStoreContractID)
     return;
 
   Services.prefs.setCharPref("mail.serverDefaultStoreContractID", aStoreContractID);
 
   // Cleanup existing files, server and account instances, if any.
   if (this._server)
     this._server.stop();
@@ -127,105 +125,93 @@ POP3Pump.prototype.resetPluggableStore =
 
   this.fakeServer = null;
   localAccountUtils.clearAll();
 
   this._incomingServer = this._createPop3ServerAndLocalFolders();
   this._mailboxStoreContractID = aStoreContractID;
 };
 
-POP3Pump.prototype._checkBusy = function _checkBusy()
-{
-  if (this._tests.length == 0 && !this._finalCleanup)
-  {
+POP3Pump.prototype._checkBusy = function() {
+  if (this._tests.length == 0 && !this._finalCleanup) {
     this._incomingServer.closeCachedConnections();
 
     // No more tests, let everything finish
     this._server.stop();
     this._finalCleanup = true;
     do_timeout(20, _checkPumpBusy);
     return;
   }
 
-  if (this._finalCleanup)
-  {
-    if (Services.tm.currentThread.hasPendingEvents())
+  if (this._finalCleanup) {
+    if (Services.tm.currentThread.hasPendingEvents()) {
       do_timeout(20, _checkPumpBusy);
-    else
-    {
+    } else {
       // exit this module
       do_test_finished();
       if (this.onDone)
         this._promise.then(this.onDone, this.onDone);
       if (this._actualResult == Cr.NS_OK)
         this._resolve();
       else
         this._reject(this._actualResult);
     }
     return;
   }
 
   // If the server hasn't quite finished, just delay a little longer.
   if (this._incomingServer.serverBusy ||
       (this._incomingServer instanceof Ci.nsIPop3IncomingServer &&
-       this._incomingServer.runningProtocol))
-  {
+       this._incomingServer.runningProtocol)) {
     do_timeout(20, _checkPumpBusy);
     return;
   }
 
   this._testNext();
 };
 
-POP3Pump.prototype._testNext = function _testNext()
-{
+POP3Pump.prototype._testNext = function() {
   let thisFiles = this._tests.shift();
   if (!thisFiles)
     this._checkBusy();  // exit
 
   // Handle the server in a try/catch/finally loop so that we always will stop
   // the server if something fails.
-  try
-  {
-    if (this._firstFile)
-    {
+  try {
+    if (this._firstFile) {
       this._firstFile = false;
 
       // Start the fake POP3 server
       this._server.start();
       this.kPOP3_PORT = this._server.port;
       if (this.fakeServer)
         this.fakeServer.port = this.kPOP3_PORT;
-    }
-    else
-    {
+    } else {
       this._server.resetTest();
     }
 
     // Set up the test
     this._daemon.setMessages(thisFiles);
 
     // Now get the mail, get inbox in case it got un-deferred.
     let inbox = this._incomingServer
                     .rootMsgFolder
                     .getFolderWithFlags(Ci.nsMsgFolderFlags.Inbox);
     this._pop3Service.GetNewMail(null, this, inbox,
                                  this._incomingServer);
 
     this._server.performTest();
-  } catch (e)
-  {
+  } catch (e) {
     this._server.stop();
 
     do_throw(e);
   }
 };
 
-POP3Pump.prototype.run = function run(aExpectedResult)
-{
+POP3Pump.prototype.run = function(aExpectedResult) {
   do_test_pending();
   // Disable new mail notifications
   Services.prefs.setBoolPref("mail.biff.play_sound", false);
   Services.prefs.setBoolPref("mail.biff.show_alert", false);
   Services.prefs.setBoolPref("mail.biff.show_tray_icon", false);
   Services.prefs.setBoolPref("mail.biff.animate_dock_icon", false);
 
   this._server = this._setupServerDaemon();
@@ -246,17 +232,17 @@ POP3Pump.prototype.run = function run(aE
   // a POP3 server.
 
   this._tests[0] = this.files;
 
   this._pop3Service = MailServices.pop3;
   this._testNext();
 
   // This probably does not work with multiple tests, but nobody is using that.
-  this._promise = new Promise( (resolve, reject) => {
+  this._promise = new Promise((resolve, reject) => {
     this._resolve = resolve;
     this._reject = reject;
   });
   return this._promise;
 };
 
 var gPOP3Pump = new POP3Pump();
 gPOP3Pump._incomingServer = gPOP3Pump._createPop3ServerAndLocalFolders();
--- a/mailnews/test/resources/PromiseTestUtils.jsm
+++ b/mailnews/test/resources/PromiseTestUtils.jsm
@@ -1,22 +1,19 @@
 /* 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/. */
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * This file provides utilities useful in using Promises and Task.jsm
  * with mailnews tests.
  */
 
-this.EXPORTED_SYMBOLS = ['PromiseTestUtils'];
+this.EXPORTED_SYMBOLS = ["PromiseTestUtils"];
 
-var CC = Components.Constructor;
-
-var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 /**
  * Url listener that can wrap another listener and trigger a callback.
  *
  * @param [aWrapped] The nsIUrlListener to pass all notifications through to.
  *     This gets called prior to the callback (or async resumption).
  */
@@ -29,21 +26,21 @@ PromiseTestUtils.PromiseUrlListener = fu
     this._resolve = resolve;
     this._reject = reject;
   });
 };
 
 PromiseTestUtils.PromiseUrlListener.prototype = {
   QueryInterface:   ChromeUtils.generateQI([Ci.nsIUrlListener]),
 
-  OnStartRunningUrl: function(aUrl) {
+  OnStartRunningUrl(aUrl) {
     if (this.wrapped && this.wrapped.OnStartRunningUrl)
       this.wrapped.OnStartRunningUrl(aUrl);
   },
-  OnStopRunningUrl: function(aUrl, aExitCode) {
+  OnStopRunningUrl(aUrl, aExitCode) {
     if (this.wrapped && this.wrapped.OnStopRunningUrl)
       this.wrapped.OnStopRunningUrl(aUrl, aExitCode);
     if (aExitCode == Cr.NS_OK)
       this._resolve();
     else
       this._reject(aExitCode);
   },
   get promise() { return this._promise; },
@@ -62,46 +59,46 @@ PromiseTestUtils.PromiseCopyListener = f
     this._resolve = resolve;
     this._reject = reject;
   });
   this._result = { messageKeys: [], messageIds: [] };
 };
 
 PromiseTestUtils.PromiseCopyListener.prototype = {
   QueryInterface: ChromeUtils.generateQI([Ci.nsIMsgCopyServiceListener]),
-  OnStartCopy: function() {
+  OnStartCopy() {
     if (this.wrapped && this.wrapped.OnStartCopy)
       this.wrapped.OnStartCopy();
   },
-  OnProgress: function(aProgress, aProgressMax) {
+  OnProgress(aProgress, aProgressMax) {
     if (this.wrapped && this.wrapped.OnProgress)
       this.wrapped.OnProgress(aProgress, aProgressMax);
   },
-  SetMessageKey: function(aKey) {
+  SetMessageKey(aKey) {
     if (this.wrapped && this.wrapped.SetMessageKey)
       this.wrapped.SetMessageKey(aKey);
 
     this._result.messageKeys.push(aKey);
   },
-  SetMessageId: function(aMessageId) {
+  SetMessageId(aMessageId) {
     if (this.wrapped && this.wrapped.SetMessageId)
       this.wrapped.SetMessageId(aMessageId);
 
     this._result.messageIds.push(aMessageId);
   },
-  OnStopCopy: function(aStatus) {
+  OnStopCopy(aStatus) {
     if (this.wrapped && this.wrapped.OnStopCopy)
       this.wrapped.OnStopCopy(aStatus);
 
     if (aStatus == Cr.NS_OK)
       this._resolve(this._result);
     else
       this._reject(aStatus);
   },
-  get promise() { return this._promise; }
+  get promise() { return this._promise; },
 };
 
 /**
  * Stream listener that can wrap another listener and trigger a callback.
  *
  * @param [aWrapped] The nsIStreamListener to pass all notifications through to.
  *     This gets called prior to the callback (or async resumption).
  */
@@ -113,61 +110,60 @@ PromiseTestUtils.PromiseStreamListener =
   });
   this._data = null;
   this._stream = null;
 };
 
 PromiseTestUtils.PromiseStreamListener.prototype = {
   QueryInterface: ChromeUtils.generateQI([Ci.nsIStreamListener]),
 
-  onStartRequest : function (aRequest, aContext) {
+  onStartRequest(aRequest, aContext) {
     if (this.wrapped && this.wrapped.onStartRequest)
       this.wrapped.onStartRequest(aRequest, aContext);
     this._data = "";
     this._stream = null;
   },
 
-  onStopRequest : function (aRequest, aContext, aStatusCode) {
+  onStopRequest(aRequest, aContext, aStatusCode) {
     if (this.wrapped && this.wrapped.onStopRequest)
       this.wrapped.onStopRequest(aRequest, aContext, aStatusCode);
     if (aStatusCode == Cr.NS_OK)
       this._resolve(this._data);
     else
       this._reject(aStatusCode);
   },
 
-  onDataAvailable : function (aRequest, aContext, aInputStream, aOff, aCount) {
+  onDataAvailable(aRequest, aContext, aInputStream, aOff, aCount) {
     if (this.wrapped && this.wrapped.onDataAvailable)
       this.wrapped.onDataAvailable(aRequest, aContext, aInputStream, aOff, aCount);
     if (!this._stream) {
       this._stream = Cc["@mozilla.org/scriptableinputstream;1"]
                      .createInstance(Ci.nsIScriptableInputStream);
       this._stream.init(aInputStream);
     }
     this._data += this._stream.read(aCount);
   },
 
-  get promise() { return this._promise; }
+  get promise() { return this._promise; },
 };
 
 /**
  * Folder listener to resolve a promise when a certain folder event occurs.
  *
  * @param folder   nsIMsgFolder to listen to
  * @param event    string event name to listen for. Example event is
  *                 "DeleteOrMoveMsgCompleted".
  * @return         promise that resolves when the event occurs
  */
 
-var nsIMFNService = Ci.nsIMsgFolderNotificationService;
-PromiseTestUtils.promiseFolderEvent = function promiseFolderEvent(folder, event) {
-  return new Promise( (resolve, reject) => {
+PromiseTestUtils.promiseFolderEvent = function(folder, event) {
+  return new Promise((resolve, reject) => {
     let folderListener = {
       QueryInterface: ChromeUtils.generateQI([Ci.nsIFolderListener]),
-      OnItemEvent: function onItemEvent(aEventFolder, aEvent) {
+      OnItemEvent(aEventFolder, aEvent) {
         if (folder === aEventFolder &&
             event == aEvent) {
           MailServices.mailSession.RemoveFolderListener(folderListener);
           resolve();
         }
       },
     };
     MailServices.mailSession.AddFolderListener(folderListener, Ci.nsIFolderListener.event);
@@ -178,17 +174,17 @@ PromiseTestUtils.promiseFolderEvent = fu
  * Folder listener to resolve a promise when a certain folder event occurs.
  *
  * @param folder            nsIMsgFolder to listen to
  * @param listenerMethod    string listener method to listen for. Example listener
                             method is "msgsClassified".
  * @return                  promise that resolves when the event occurs
  */
 PromiseTestUtils.promiseFolderNotification = function(folder, listenerMethod) {
-  return new Promise( (resolve, reject) => {
+  return new Promise((resolve, reject) => {
     let mfnListener = {};
     mfnListener[listenerMethod] = function() {
       let args = Array.from(arguments);
       let flag = true;
       for (let arg of args) {
         if (folder && arg instanceof Ci.nsIMsgFolder) {
           if (arg == folder) {
             flag = true;
@@ -198,60 +194,59 @@ PromiseTestUtils.promiseFolderNotificati
           }
         }
       }
 
       if (flag) {
         MailServices.mfn.removeListener(mfnListener);
         resolve(args);
       }
-    }
+    };
     MailServices.mfn.addListener(
       mfnListener, Ci.nsIMsgFolderNotificationService[listenerMethod]);
   });
-}
+};
 
 /**
  * Folder listener to resolve a promise when a folder with a certain
  * name is added.
  *
  * @param name     folder name to listen for
  * @return         promise{folder} that resolves with the new folder when the
  *                 folder add completes
  */
 
-PromiseTestUtils.promiseFolderAdded = function promiseFolderAdded(folderName) {
+PromiseTestUtils.promiseFolderAdded = function(folderName) {
   return new Promise((resolve, reject) => {
     var listener = {
        folderAdded: aFolder => {
          if (aFolder.name == folderName) {
            MailServices.mfn.removeListener(listener);
            resolve(aFolder);
          }
-       }
+       },
     };
     MailServices.mfn.addListener(listener,
       Ci.nsIMsgFolderNotificationService.folderAdded);
   });
-}
+};
 
 /**
  * Timer to resolve a promise after a delay
  *
  * @param aDelay    delay in milliseconds
  * @return          promise that resolves after the delay
  */
 
-PromiseTestUtils.promiseDelay = function promiseDelay(aDelay)
-{
+PromiseTestUtils.promiseDelay = function(aDelay) {
   return new Promise((resolve, reject) => {
     let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     timer.initWithCallback(resolve, aDelay, Ci.nsITimer.TYPE_ONE_SHOT);
   });
-}
+};
 
 /**
  * Search listener to resolve a promise when a search completes
  *
  * @param [aSearchSession] The nsIMsgSearchSession to search
  * @param [aWrapped] The nsIMsgSearchNotify to pass all notifications through to.
  *     This gets called prior to the callback (or async resumption).
  */
@@ -259,30 +254,30 @@ PromiseTestUtils.promiseDelay = function
 PromiseTestUtils.PromiseSearchNotify = function(aSearchSession, aWrapped) {
   this._searchSession = aSearchSession;
   this._searchSession.registerListener(this);
   this.wrapped = aWrapped;
   this._promise = new Promise((resolve, reject) => {
     this._resolve = resolve;
     this._reject = reject;
   });
-}
+};
 
 PromiseTestUtils.PromiseSearchNotify.prototype = {
   QueryInterface: ChromeUtils.generateQI([Ci.nsIMsgSearchNotify]),
-  onSearchHit: function(aHeader, aFolder) {
+  onSearchHit(aHeader, aFolder) {
     if (this.wrapped && this.wrapped.onSearchHit)
       this.wrapped.onSearchHit(aHeader, aFolder);
   },
-  onSearchDone: function onSearchDone(aResult) {
+  onSearchDone(aResult) {
     this._searchSession.unregisterListener(this);
     if (this.wrapped && this.wrapped.onSearchDone)
       this.wrapped.onSearchDone(aResult);
     if (aResult == Cr.NS_OK)
       this._resolve();
     else
       this._reject(aResult);
   },
-  onNewSearch: function onNewSearch() {
+  onNewSearch() {
     if (this.wrapped && this.wrapped.onNewSearch)
       this.wrapped.onNewSearch();
-  }
-}
+  },
+};
--- a/mailnews/test/resources/abSetup.js
+++ b/mailnews/test/resources/abSetup.js
@@ -1,45 +1,47 @@
+/* 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/. */
+
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
  * Sets up the directory service provider to return the app dir as the profile
  * directory for the address book to use for locating its files during the
  * tests.
  *
  * Note there are further configuration setup items below this.
  */
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /**
  * General Configuration Data that applies to the address book.
  */
 
 // Personal Address Book configuration items.
-var kPABData =
-{
+var kPABData = {
   URI: "moz-abmdbdirectory://abook.mab",
   fileName: "abook.mab",
   dirName: "Personal Address Book",
   dirType: 2,
   dirPrefID: "ldap_2.servers.pab",
   readOnly: false,
-  position: 1
+  position: 1,
 };
 
 // Collected Address Book configuration items.
-var kCABData =
-{
+var kCABData = {
   URI: "moz-abmdbdirectory://history.mab",
   fileName: "history.mab",
   dirName: "Collected Addresses",
   dirType: 2,
   dirPrefID: "ldap_2.servers.history",
   readOnly: false,
-  position: 2
+  position: 2,
 };
 
 // Windows (Outlook Express) Address Book deactivation. (Bug 448859)
 Services.prefs.deleteBranch("ldap_2.servers.oe.");
 
 // OSX Address Book deactivation (Bug 955842)
 Services.prefs.deleteBranch("ldap_2.servers.osx.");
 
--- a/mailnews/test/resources/alertTestUtils.js
+++ b/mailnews/test/resources/alertTestUtils.js
@@ -1,8 +1,12 @@
+/* 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/. */
+
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
  * This file provides support for writing mailnews tests that require hooking
  * into the alerts system. Normally these tests would require a UI and fail in
  * debug mode, but with this method you can hook into the alerts system and
  * avoid the UI.
  *
  * This file registers prompts for nsIWindowWatcher::getNewPrompter and also
@@ -31,232 +35,236 @@
 
 var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 var {MockRegistrar} = ChromeUtils.import("resource://testing-common/MockRegistrar.jsm");
 
 // Wrapper to the nsIPrompt interface.
 // This allows the send code to attempt to display errors to the user without
 // failing.
 var alertUtilsPrompts = {
-  alert: function(aDialogTitle, aText) {
+  alert(aDialogTitle, aText) {
     if (typeof alert == "function") {
       alert(aDialogTitle, aText);
       return;
     }
 
     do_throw("alert unexpectedly called: " + aText + "\n");
-    return;
   },
 
-  alertCheck: function(aDialogTitle, aText, aCheckMsg, aCheckState) {
+  alertCheck(aDialogTitle, aText, aCheckMsg, aCheckState) {
     if (typeof alertCheck == "function") {
+      // eslint-disable-next-line no-undef
       alertCheck(aDialogTitle, aText, aCheckMsg, aCheckState);
       return;
     }
 
     do_throw("alertCheck unexpectedly called: " + aText + "\n");
-    return;
   },
 
-  confirm: function(aDialogTitle, aText) {
+  confirm(aDialogTitle, aText) {
     if (typeof confirm == "function") {
       return confirm(aDialogTitle, aText);
     }
 
     do_throw("confirm unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  confirmCheck: function(aDialogTitle, aText, aCheckMsg, aCheckState) {
+  confirmCheck(aDialogTitle, aText, aCheckMsg, aCheckState) {
     if (typeof confirmCheck == "function") {
+      // eslint-disable-next-line no-undef
       return confirmCheck(aDialogTitle, aText, aCheckMsg, aCheckState);
     }
 
     do_throw("confirmCheck unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  confirmEx: function(aDialogTitle, aText, aButtonFlags, aButton0Title,
-                      aButton1Title, aButton2Title, aCheckMsg, aCheckState) {
+  confirmEx(aDialogTitle, aText, aButtonFlags, aButton0Title,
+            aButton1Title, aButton2Title, aCheckMsg, aCheckState) {
     if (typeof confirmEx == "function") {
+      // eslint-disable-next-line no-undef
       return confirmEx(aDialogTitle, aText, aButtonFlags, aButton0Title,
                        aButton1Title, aButton2Title, aCheckMsg, aCheckState);
     }
 
     do_throw("confirmEx unexpectedly called: " + aText + "\n");
     return 0;
   },
 
-  prompt: function(aDialogTitle, aText, aValue, aCheckMsg, aCheckState) {
+  prompt(aDialogTitle, aText, aValue, aCheckMsg, aCheckState) {
     if (typeof prompt == "function") {
       return prompt(aDialogTitle, aText, aValue, aCheckMsg, aCheckState);
     }
 
     do_throw("prompt unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  promptUsernameAndPassword: function(aDialogTitle, aText, aUsername,
-                                      aPassword, aCheckMsg, aCheckState) {
+  promptUsernameAndPassword(aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState) {
     if (typeof promptUsernameAndPassword == "function") {
+      // eslint-disable-next-line no-undef
       return promptUsernameAndPassword(aDialogTitle, aText, aUsername,
                                        aPassword, aCheckMsg, aCheckState);
     }
 
     do_throw("promptUsernameAndPassword unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  promptPassword: function(aDialogTitle, aText, aPassword, aCheckMsg,
-                           aCheckState) {
+  promptPassword(aDialogTitle, aText, aPassword, aCheckMsg, aCheckState) {
     if (typeof promptPassword == "function") {
+      // eslint-disable-next-line no-undef
       return promptPassword(aDialogTitle, aText, aPassword, aCheckMsg,
                             aCheckState);
     }
 
     do_throw("promptPassword unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  select: function(aDialogTitle, aText, aCount, aSelectList,
-                   aOutSelection) {
+  select(aDialogTitle, aText, aCount, aSelectList, aOutSelection) {
     if (typeof select == "function") {
+      // eslint-disable-next-line no-undef
       return select(aDialogTitle, aText, aCount, aSelectList,
                     aOutSelection);
     }
 
     do_throw("select unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  QueryInterface: ChromeUtils.generateQI([Ci.nsIPrompt])
+  QueryInterface: ChromeUtils.generateQI([Ci.nsIPrompt]),
 };
 
 var alertUtilsPromptService = {
-   alert: function(aParent, aDialogTitle, aText) {
+   alert(aParent, aDialogTitle, aText) {
     if (typeof alertPS == "function") {
+      // eslint-disable-next-line no-undef
       alertPS(aParent, aDialogTitle, aText);
       return;
     }
 
     do_throw("alertPS unexpectedly called: " + aText + "\n");
-    return;
   },
 
-  alertCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
+  alertCheck(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
     if (typeof alertCheckPS == "function") {
+      // eslint-disable-next-line no-undef
       alertCheckPS(aParent, aDialogTitle, aText, aCheckMsg, aCheckState);
       return;
     }
 
     do_throw("alertCheckPS unexpectedly called: " + aText + "\n");
-    return;
   },
 
-  confirm: function(aParent, aDialogTitle, aText) {
+  confirm(aParent, aDialogTitle, aText) {
     if (typeof confirmPS == "function") {
+      // eslint-disable-next-line no-undef
       return confirmPS(aParent, aDialogTitle, aText);
     }
 
     do_throw("confirmPS unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  confirmCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
+  confirmCheck(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
     if (typeof confirmCheckPS == "function") {
+      // eslint-disable-next-line no-undef
       return confirmCheckPS(aParent, aDialogTitle, aText, aCheckMsg,
                             aCheckState);
     }
 
     do_throw("confirmCheckPS unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  confirmEx: function(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title,
-                      aButton1Title, aButton2Title, aCheckMsg, aCheckState) {
+  confirmEx(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title,
+            aButton1Title, aButton2Title, aCheckMsg, aCheckState) {
     if (typeof confirmExPS == "function") {
+      // eslint-disable-next-line no-undef
       return confirmExPS(aParent, aDialogTitle, aText, aButtonFlags,
                          aButton0Title, aButton1Title, aButton2Title, aCheckMsg,
                          aCheckState);
     }
 
     do_throw("confirmExPS unexpectedly called: " + aText + "\n");
     return 0;
   },
 
-  prompt: function(aParent, aDialogTitle, aText, aValue, aCheckMsg,
-                   aCheckState) {
+  prompt(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState) {
     if (typeof promptPS == "function") {
+      // eslint-disable-next-line no-undef
       return promptPS(aParent, aDialogTitle, aText, aValue, aCheckMsg,
                       aCheckState);
     }
 
     do_throw("promptPS unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  promptUsernameAndPassword: function(aParent, aDialogTitle, aText, aUsername,
-                                      aPassword, aCheckMsg, aCheckState) {
+  promptUsernameAndPassword(aParent, aDialogTitle, aText, aUsername,
+                            aPassword, aCheckMsg, aCheckState) {
     if (typeof promptUsernameAndPasswordPS == "function") {
+      // eslint-disable-next-line no-undef
       return promptUsernameAndPasswordPS(aParent, aDialogTitle, aText,
                                          aUsername, aPassword, aCheckMsg,
                                          aCheckState);
     }
 
     do_throw("promptUsernameAndPasswordPS unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  promptPassword: function(aParent, aDialogTitle, aText, aPassword, aCheckMsg,
-                           aCheckState) {
+  promptPassword(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState) {
     if (typeof promptPasswordPS == "function") {
+      // eslint-disable-next-line no-undef
       return promptPasswordPS(aParent, aDialogTitle, aText, aPassword,
                               aCheckMsg, aCheckState);
     }
 
     do_throw("promptPasswordPS unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  select: function(aParent, aDialogTitle, aText, aCount, aSelectList,
-                   aOutSelection) {
+  select(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection) {
     if (typeof selectPS == "function") {
+      // eslint-disable-next-line no-undef
       return selectPS(aParent, aDialogTitle, aText, aCount, aSelectList,
                       aOutSelection);
     }
 
     do_throw("selectPS unexpectedly called: " + aText + "\n");
     return false;
   },
 
-  createInstance: function createInstance(outer, iid) {
+  createInstance(outer, iid) {
     if (outer != null)
       throw Cr.NS_ERROR_NO_AGGREGATION;
     return this.QueryInterface(iid);
   },
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsIPromptService,
-                                          Ci.nsIPromptService2])
+                                          Ci.nsIPromptService2]),
 };
 
 var alertUtilsWindowWatcher = {
-  getNewPrompter: function(aParent) {
+  getNewPrompter(aParent) {
     return alertUtilsPrompts;
   },
 
-  getNewAuthPrompter: function(aParent) {
+  getNewAuthPrompter(aParent) {
     return Cc["@mozilla.org/login-manager/prompter;1"]
             .getService(Ci.nsIAuthPrompt);
   },
 
-  QueryInterface: ChromeUtils.generateQI([Ci.nsIWindowWatcher])
+  QueryInterface: ChromeUtils.generateQI([Ci.nsIWindowWatcher]),
 };
 
-function registerAlertTestUtils()
-{
+function registerAlertTestUtils() {
   MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1",
                       alertUtilsWindowWatcher);
   MockRegistrar.register("@mozilla.org/embedcomp/prompt-service;1",
                       alertUtilsPromptService);
 }
 
 // Dummy message window that ensures we get prompted for logins.
 
--- a/mailnews/test/resources/asyncTestUtils.js
+++ b/mailnews/test/resources/asyncTestUtils.js
@@ -1,8 +1,14 @@
+/* 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 logHelper.js */
+
 /*
  * This file provides support for writing mailnews tests using generators so
  *  your test code can be simple and straight-forward.  We provide both the
  *  core routines to do this (async_run, async_driver), as well as helper
  *  routines specialized to
  *
  * Here's some example-ish code:
  *
@@ -39,51 +45,49 @@ var {logException} = ChromeUtils.import(
  *     simply call async_driver instead.
  */
 function AsyncUrlListener(aWrapped, aCallback, aPromise) {
   this.wrapped = aWrapped ? aWrapped.QueryInterface(Ci.nsIUrlListener) : null;
   this.callback = aCallback;
   this.promise = aPromise;
 }
 AsyncUrlListener.prototype = {
-  OnStartRunningUrl: function asyncUrlListener_OnStartRunningUrl(
-                         aUrl) {
+  OnStartRunningUrl(aUrl) {
     if (this.wrapped)
       this.wrapped.OnStartRunningUrl(aUrl);
   },
-  OnStopRunningUrl: function asyncUrlListener_OnStopRunningUrl(
-                         aUrl, aExitCode) {
+  OnStopRunningUrl(aUrl, aExitCode) {
     if (this.wrapped)
       this.wrapped.OnStopRunningUrl(aUrl, aExitCode);
     if (this.callback)
       this.callback(aUrl, aExitCode);
     if (this.promise)
       this.promise();
     else
       async_driver();
-  }
+  },
 };
 
 /**
  * nsIUrlListener that calls async_driver when the URL stops running.  Pass this
  *  in as an argument to asynchronous native mechanisms that use a URL listener
  *  to notify when they complete.  If you need to wrap an existing listener
  *  and/or have a callback notified before triggering the async process, create
  *  your own instance of |AsyncUrlListener|.
  */
 var asyncUrlListener = new AsyncUrlListener();
 
 var asyncCopyListener = {
-  OnStartCopy: function() {},
-  OnProgress: function(aProgress, aProgressMax) {},
-  SetMessageKey: function(aMsgKey) {},
-  GetMessageId: function() {},
-  OnStopCopy: function(aStatus) {
+  OnStartCopy() {},
+  OnProgress(aProgress, aProgressMax) {},
+  SetMessageKey(aMsgKey) {},
+  GetMessageId() {},
+  OnStopCopy(aStatus) {
     async_driver();
-  }
+  },
 };
 
 var asyncGeneratorStack = [], asyncGeneratorSendValue = undefined;
 
 /**
  * Run a function that may or may not be a generator.  All functions, generator
  *  or not, must return false if they do not want the async_driver to run the
  *  next logical work step.  Returning no value (undefined) or true indicates to
@@ -108,22 +112,20 @@ function async_run(aArgs) {
   if (result && result.next) {
     asyncGeneratorStack.push([result, aArgs.func.name]);
     // Use the timer variant in case the asynchronous sub-call is able to run
     //  to completion.  If we didn't do this, we might end up trying to re-call
     //  into the same generator that is currently active.  We can obviously
     //  make _async_driver more clever to deal with this if we have a reason.
     return async_driver();
   }
-  else {
-    if (result === undefined)
-      return true;
-    else
-      return result;
-  }
+
+  if (result === undefined)
+    return true;
+  return result;
 }
 
 /**
  * Function to kick off/resume asynchronous processing.  Any function invoked by
  *  async_run that returns/yields false at any point is responsible for ensuring
  *  async_driver() is called again once the async operation completes.
  *
  * Note: This function actually schedules the real driver to run after a
@@ -146,34 +148,33 @@ function async_driver(val) {
  *  after each step.
  */
 var asyncExpectedEarlyAbort = "REAP!";
 
 // the real driver!
 function _async_driver() {
   let curGenerator;
   while (asyncGeneratorStack.length) {
-    curGenerator = asyncGeneratorStack[asyncGeneratorStack.length-1][0];
+    curGenerator = asyncGeneratorStack[asyncGeneratorStack.length - 1][0];
     try {
       let nextItem;
       do {
         nextItem = curGenerator.next(asyncGeneratorSendValue);
         if (!nextItem.value || nextItem.done)
           break;
         asyncGeneratorSendValue = undefined;
       } while (true);
 
       if (nextItem.done) {
         asyncGeneratorStack.pop();
       } else {
         asyncGeneratorSendValue = undefined;
         return false;
       }
-    }
-    catch (ex) {
+    } catch (ex) {
       if (ex != asyncExpectedEarlyAbort) {
         let asyncStack = [];
         dump("*******************************************\n");
         dump("Generator explosion!\n");
         dump("Unhappiness at: " + (ex.fileName || ex.filename) + ":" + ex.lineNumber + "\n");
         dump("Because: " + ex + "\n");
         if (ex.stack)
           dump("Stack:\n  " + ex.stack.replace(/\n/g, "\n  ") + "\n");
@@ -222,23 +223,22 @@ function _async_test_runner_postTest() {
   }
 }
 
 function _async_test_runner_timeout() {
   for (let helper of ASYNC_TEST_RUNNER_HELPERS) {
     try {
       if (helper.onTimeout)
         helper.onTimeout();
-    }
-    catch (ex) {
+    } catch (ex) {
       dump("warning: helper failure: (" + ex.fileName + ":" + ex.lineNumber +
            "): " + ex + "\n");
     }
   }
-  do_throw('Timeout running test, and we want you to have the log.');
+  do_throw("Timeout running test, and we want you to have the log.");
 }
 
 /**
  * Purely decorative function to help explain to people reading lists of tests
  *  using async_run_tests what is going on.  We just return a tuple of our
  *  arguments and _async_test_runner understands what to do with this, namely
  *  to run the test once for each element in the aParameters list.  If the
  *  elements in the aParameters list have a 'name' attribute, it will get
@@ -270,48 +270,43 @@ function* _async_test_runner(aTests) {
     if (test.length) {
       let [testFunc, parameters] = test;
       for (let parameter of parameters) {
         let paramDesc, args;
         if (typeof(parameter) == "object") {
           if (parameter.length) {
             paramDesc = parameter.toString();
             args = parameter;
-          }
-          else {
+          } else {
             paramDesc = parameter.name;
             args = [parameter];
           }
-        }
-        else {
+        } else {
           paramDesc = parameter.toString();
           args = [parameter];
         }
         mark_test_start(testFunc.name, paramDesc);
-        yield async_run({func: testFunc, args: args});
+        yield async_run({func: testFunc, args});
         _async_test_runner_postTest();
         mark_test_end();
       }
-
-    }
-    else {
+    } else {
       mark_test_start(test.name);
       yield async_run({func: test});
       _async_test_runner_postTest();
       mark_test_end();
     }
   }
 
   dump("=== (Done With Tests)\n");
 
   for (let cleanupHelper of ASYNC_TEST_RUNNER_FINAL_CLEANUP_HELPERS) {
     try {
       cleanupHelper();
-    }
-    catch (ex) {
+    } catch (ex) {
       mark_failure(["Problem during asyncTestUtils cleanup helper",
                      cleanupHelper.name, "exception:", ex]);
     }
   }
 
   mark_all_tests_run();
 
   do_test_finished();
--- a/mailnews/test/resources/filterTestUtils.js
+++ b/mailnews/test/resources/filterTestUtils.js
@@ -1,35 +1,37 @@
+/* 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/. */
+
 // Utility functions for testing interactions with filters.
 
 var contains = Ci.nsMsgSearchOp.Contains;
 // This maps strings to a filter attribute (excluding the parameter)
 var ATTRIB_MAP = {
   // Template : [attrib, op, field of value, otherHeader]
-  "subject" : [Ci.nsMsgSearchAttrib.Subject, contains, "str", null],
-  "from" : [Ci.nsMsgSearchAttrib.Sender, contains, "str", null],
-  "date" : [Ci.nsMsgSearchAttrib.Date, Ci.nsMsgSearchOp.Is, "date", null],
-  "size" : [Ci.nsMsgSearchAttrib.Size, Ci.nsMsgSearchOp.Is, "size", null],
-  "message-id" : [Ci.nsMsgSearchAttrib.OtherHeader+1, contains, "str",
-                  "Message-ID"],
-  "user-agent" : [Ci.nsMsgSearchAttrib.OtherHeader+2, contains, "str",
-                  "User-Agent"]
+  "subject": [Ci.nsMsgSearchAttrib.Subject, contains, "str", null],
+  "from": [Ci.nsMsgSearchAttrib.Sender, contains, "str", null],
+  "date": [Ci.nsMsgSearchAttrib.Date, Ci.nsMsgSearchOp.Is, "date", null],
+  "size": [Ci.nsMsgSearchAttrib.Size, Ci.nsMsgSearchOp.Is, "size", null],
+  "message-id": [Ci.nsMsgSearchAttrib.OtherHeader + 1, contains, "str", "Message-ID"],
+  "user-agent": [Ci.nsMsgSearchAttrib.OtherHeader + 2, contains, "str", "User-Agent"],
 };
 // And this maps strings to filter actions
 var ACTION_MAP = {
   // Template : [action, auxiliary attribute field, auxiliary value]
-  "priority" : [Ci.nsMsgFilterAction.ChangePriority, "priority", 6],
-  "delete" : [Ci.nsMsgFilterAction.Delete],
-  "read" : [Ci.nsMsgFilterAction.MarkRead],
-  "unread" : [Ci.nsMsgFilterAction.MarkUnread],
-  "kill" : [Ci.nsMsgFilterAction.KillThread],
-  "watch" : [Ci.nsMsgFilterAction.WatchThread],
-  "flag" : [Ci.nsMsgFilterAction.MarkFlagged],
+  "priority": [Ci.nsMsgFilterAction.ChangePriority, "priority", 6],
+  "delete": [Ci.nsMsgFilterAction.Delete],
+  "read": [Ci.nsMsgFilterAction.MarkRead],
+  "unread": [Ci.nsMsgFilterAction.MarkUnread],
+  "kill": [Ci.nsMsgFilterAction.KillThread],
+  "watch": [Ci.nsMsgFilterAction.WatchThread],
+  "flag": [Ci.nsMsgFilterAction.MarkFlagged],
   "stop": [Ci.nsMsgFilterAction.StopExecution],
-  "tag" : [Ci.nsMsgFilterAction.AddTag, "strValue", "tag"]
+  "tag": [Ci.nsMsgFilterAction.AddTag, "strValue", "tag"],
 };
 
 /**
  * Creates a filter and appends it to the nsIMsgFilterList.
  *
  * @param list    An nsIMsgFilter to which the new filter will be appended.
  * @param trigger A key of ATTRIB_MAP that represents the filter trigger.
  * @param value   The value of the filter trigger.
--- a/mailnews/test/resources/folderEventLogHelper.js
+++ b/mailnews/test/resources/folderEventLogHelper.js
@@ -1,11 +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/. */
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* import-globals-from logHelper.js */
 
 /*
  * Hook up folder notifications to logHelper.js.  This is for the benefit of
  *  gloda but others can benefit too.  Cramming it in gloda's file structure
  *  for now.
  */
 
 var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
@@ -35,125 +37,115 @@ function registerFolderEventLogHelper() 
         Ci.nsIMsgFolderNotificationService.itemEvent);
 }
 
 /**
  * nsIMsgFolderListener implementation to logHelper events that gloda cares
  *  about.
  */
 var _folderEventLogHelper_msgFolderListener = {
-  msgAdded: function felh_msgAdded(aMsg) {
+  msgAdded(aMsg) {
     mark_action("msgEvent", "msgAdded", [aMsg]);
   },
 
-  msgsClassified: function felh_msgsClassified(aMsgs, aJunkProcessed,
-                                               aTraitProcessed) {
+  msgsClassified(aMsgs, aJunkProcessed, aTraitProcessed) {
     let args = [
       aJunkProcessed ? "junk processed" : "did not junk process",
-      aTraitProcessed ? "trait processed" : "did not trait process"
+      aTraitProcessed ? "trait processed" : "did not trait process",
     ];
     for (let msgHdr of fixIterator(aMsgs, Ci.nsIMsgDBHdr)) {
       args.push(msgHdr);
     }
     mark_action("msgEvent", "msgsClassified", args);
   },
 
-  msgsDeleted: function felh_msgsDeleted(aMsgs) {
+  msgsDeleted(aMsgs) {
     let args = [];
     for (let msgHdr of fixIterator(aMsgs, Ci.nsIMsgDBHdr)) {
       args.push(msgHdr);
     }
     mark_action("msgEvent", "msgsDeleted", args);
   },
 
-  msgsMoveCopyCompleted: function felh_msgsMoveCopyCompleted(aMove, aSrcMsgs,
-                                                             aDestFolder,
-                                                             aDestMsgs) {
+  msgsMoveCopyCompleted(aMove, aSrcMsgs, aDestFolder, aDestMsgs) {
     let args = [aMove ? "moved" : "copied"];
     for (let msgHdr of fixIterator(aSrcMsgs, Ci.nsIMsgDBHdr)) {
       args.push(msgHdr);
     }
     args.push("to");
     args.push(aDestFolder);
     if (aDestMsgs) {
       args.push("dest headers:");
       for (let msgHdr of fixIterator(aDestMsgs, Ci.nsIMsgDBHdr)) {
         args.push(msgHdr);
       }
     }
     mark_action("msgEvent", "msgsMoveCopyCompleted", args);
   },
 
-  msgKeyChanged: function felh_msgKeyChanged(aOldMsgKey, aNewMsgHdr) {
+  msgKeyChanged(aOldMsgKey, aNewMsgHdr) {
     let args = ["old key", aOldMsgKey, "new header", aNewMsgHdr];
     mark_action("msgEvent", "msgKeyChanged", args);
   },
 
-  folderAdded: function felh_folderAdded(aFolder) {
+  folderAdded(aFolder) {
     mark_action("msgEvent", "folderAdded", [aFolder]);
   },
 
-  folderDeleted: function felh_folderDeleted(aFolder) {
+  folderDeleted(aFolder) {
     mark_action("msgEvent", "folderDeleted", [aFolder]);
   },
 
-  folderMoveCopyCompleted: function felh_folderMoveCopyCompleted(aMove,
-                                                                 aSrcFolder,
-                                                                 aDestFolder) {
+  folderMoveCopyCompleted(aMove, aSrcFolder, aDestFolder) {
     mark_action("msgEvent", "folderMoveCopyCompleted",
                 [aMove ? "move" : "copy",
                  aSrcFolder, "to", aDestFolder]);
   },
 
-  folderRenamed: function felh_folderRenamed(aOrigFolder, aNewFolder) {
+  folderRenamed(aOrigFolder, aNewFolder) {
     mark_action("msgEvent", "folderRenamed", [aOrigFolder, "to", aNewFolder]);
   },
 
-  itemEvent: function felh_itemEvent(aItem, aEvent, aData, aString) {
+  itemEvent(aItem, aEvent, aData, aString) {
     mark_action("msgEvent", "itemEvent", [aItem, aEvent, aData, aString]);
-  }
+  },
 };
 
 
 /**
  * nsIFolderListener implementation to logHelper stuff that gloda cares about.
  */
 var _folderEventLogHelper_folderListener = {
-  OnItemAdded: function felh_OnItemAdded(aParentItem, aItem) {
+  OnItemAdded(aParentItem, aItem) {
   },
-  OnItemRemoved: function felh_OnItemRemoved(aParentItem, aItem) {
+  OnItemRemoved(aParentItem, aItem) {
   },
-  OnItemPropertyChanged: function felh_OnItemPropertyChanged(
-    aItem, aProperty, aOldValue, aNewValue) {
+  OnItemPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
   },
-  OnItemIntPropertyChanged: function felh_OnItemIntPropertyChanged(
-    aItem, aProperty, aOldValue, aNewValue) {
+  OnItemIntPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
   },
-  OnItemBoolPropertyChanged: function felh_OnItemBoolPropertyChanged(
-    aItem, aProperty, aOldValue, aNewValue) {
+  OnItemBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
   },
-  OnItemUnicharPropertyChanged: function felh_OnItemUnicharPropertyChanged(
-    aItem, aProperty, aOldValue, aNewValue) {
+  OnItemUnicharPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
   },
   /**
    * Notice when user activity adds/removes tags or changes a message's
    *  status.
    */
-  OnItemPropertyFlagChanged: function felh_OnItemPropertyFlagChanged(
-      aMsgHdr, aProperty, aOldValue, aNewValue) {
+  OnItemPropertyFlagChanged(aMsgHdr, aProperty, aOldValue, aNewValue) {
     mark_action("msgEvent", "OnItemPropertyFlagChanged",
                 ["Header", aMsgHdr,
                  "had property " + aProperty + " have the " +
                  "following bits change: " +
                  _explode_flags(aOldValue ^ aNewValue,
                                 Ci.nsMsgMessageFlags)]);
   },
 
   /**
    * Get folder loaded notifications for folders that had to do some
    *  (asynchronous) processing before they could be opened.
    */
-  OnItemEvent: function felh_OnItemEvent(aFolder, aEvent) {
+  OnItemEvent(aFolder, aEvent) {
     mark_action("msgEvent", "OnItemEvent",
                 [aFolder, aEvent]);
   },
 };
 
--- a/mailnews/test/resources/localAccountUtils.js
+++ b/mailnews/test/resources/localAccountUtils.js
@@ -1,20 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
 this.EXPORTED_SYMBOLS = ["localAccountUtils"];
 
 // MailServices
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
-var CC = Components.Constructor;
-
 // Local Mail Folders. Requires prior setup of profile directory
 
 var localAccountUtils = {
   inboxFolder: undefined,
   incomingServer: undefined,
   rootFolder: undefined,
   msgAccount: undefined,
 
@@ -57,57 +55,52 @@ var localAccountUtils = {
     // Note: Inbox is not created automatically when there is no deferred server,
     // so we need to create it.
     this.inboxFolder = this.rootFolder.createLocalSubfolder("Inbox")
                          .QueryInterface(Ci.nsIMsgLocalMailFolder);
     // a local inbox should have a Mail flag!
     this.inboxFolder.setFlag(Ci.nsMsgFolderFlags.Mail);
 
     // Force an initialization of the Inbox folder database.
-    var folderName = this.inboxFolder.prettyName;
+    this.inboxFolder.prettyName;
 
     this._localAccountInitialized = true;
   },
 
   /**
    * Create an nsIMsgIncomingServer and an nsIMsgAccount to go with it.
    *
    * @param aType The type of the server (pop3, imap etc).
    * @param aPort The port the server is on.
    * @param aUsername The username for the server.
    * @param aPassword The password for the server.
    * @param aHostname The hostname for the server (defaults to localhost).
    * @return The newly-created nsIMsgIncomingServer.
    */
-  create_incoming_server(aType, aPort, aUsername, aPassword,
-                         aHostname="localhost") {
+  create_incoming_server(aType, aPort, aUsername, aPassword, aHostname = "localhost") {
     let serverAndAccount = localAccountUtils.
-      create_incoming_server_and_account(aType, aPort, aUsername, aPassword,
-                                         aHostname);
+      create_incoming_server_and_account(aType, aPort, aUsername, aPassword, aHostname);
     return serverAndAccount.server;
   },
 
   /**
    * Create an nsIMsgIncomingServer and an nsIMsgAccount to go with it.
    * There are no identities created for the account.
    *
    * @param aType The type of the server (pop3, imap etc).
    * @param aPort The port the server is on.
    * @param aUsername The username for the server.
    * @param aPassword The password for the server.
    * @param aHostname The hostname for the server (defaults to localhost).
    * @return An object with the newly-created nsIMsgIncomingServer as the
              "server" property and the newly-created nsIMsgAccount as the
              "account" property.
    */
-  create_incoming_server_and_account(aType, aPort, aUsername, aPassword,
-                                     aHostname="localhost") {
-    let server = MailServices.accounts.createIncomingServer(aUsername,
-                                                            aHostname,
-                                                            aType);
+  create_incoming_server_and_account(aType, aPort, aUsername, aPassword, aHostname = "localhost") {
+    let server = MailServices.accounts.createIncomingServer(aUsername, aHostname, aType);
     server.port = aPort;
     if (aUsername != null)
       server.username = aUsername;
     if (aPassword != null)
       server.password = aPassword;
 
     server.valid = false;
 
@@ -117,29 +110,29 @@ var localAccountUtils = {
       // Several tests expect that mail is deferred to the local folders account,
       // so do that.
       this.loadLocalMailAccount();
       server.QueryInterface(Ci.nsIPop3IncomingServer);
       server.deferredToAccount = this.msgAccount.key;
     }
     server.valid = true;
 
-    return {server: server, account: account};
+    return {server, account};
   },
 
   /**
    * Create an outgoing nsISmtpServer with the given parameters.
    *
    * @param aPort The port the server is on.
    * @param aUsername The username for the server
    * @param aPassword The password for the server
    * @param aHostname The hostname for the server (defaults to localhost).
    * @return The newly-created nsISmtpServer.
    */
-  create_outgoing_server(aPort, aUsername, aPassword, aHostname="localhost") {
+  create_outgoing_server(aPort, aUsername, aPassword, aHostname = "localhost") {
     let server = MailServices.smtp.createServer();
     server.hostname = aHostname;
     server.port = aPort;
     server.authMethod = Ci.nsMsgAuthMethod.none;
     return server;
   },
 
   /**
@@ -158,10 +151,10 @@ var localAccountUtils = {
 
     let identity = MailServices.accounts.createIdentity();
     identity.smtpServerKey = aOutgoingServer.key;
 
     aIncoming.addIdentity(identity);
 
     if (aSetAsDefault)
       aIncoming.defaultIdentity = identity;
-  }
+  },
 };
--- a/mailnews/test/resources/logHelper.js
+++ b/mailnews/test/resources/logHelper.js
@@ -1,21 +1,26 @@
+/* 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/. */
+
 /*
  * Makes everything awesome if you are Andrew.  Some day it will make everything
  *  awesome if you are not awesome too.
  *
  * Right now the most meaningful thing to know is that if XPCOM failures happen
  *  (and get reported to the error console), this will induce a unit test
  *  failure.  You should think this is awesome no matter whether you are Andrew
  *  or not.
  */
 
 var {Log4Moz} = ChromeUtils.import("resource:///modules/gloda/log4moz.js");
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var {IOUtils} = ChromeUtils.import("resource:///modules/IOUtils.js");
+// eslint-disable-next-line mozilla/reject-importGlobalProperties
 Cu.importGlobalProperties(["Element", "Node"]);
 
 var _mailnewsTestLogger;
 var _xpcshellLogger;
 var _testLoggerContexts = [];
 var _testLoggerActiveContext;
 
 var _logHelperInterestedListeners = false;
@@ -38,74 +43,69 @@ function logHelperHasInterestedListeners
  * Tunnel nsIScriptErrors that show up on the error console to Log4Moz.  We could
  *  send everything but I think only script errors are likely of much concern.
  *  Also, this nicely avoids infinite recursions no matter what you do since
  *  what we publish is not going to end up as an nsIScriptError.
  *
  * This is based on my (asuth') exmmad extension.
  */
 var _errorConsoleTunnel = {
-  initialize: function () {
+  initialize() {
     Services.console.registerListener(this);
 
     // we need to unregister our listener at shutdown if we don't want explosions
     Services.obs.addObserver(this, "quit-application");
   },
 
-  shutdown: function () {
+  shutdown() {
     Services.console.unregisterListener(this);
     Services.obs.removeObserver(this, "quit-application");
   },
 
-  observe: function (aMessage, aTopic, aData) {
+  observe(aMessage, aTopic, aData) {
     if (aTopic == "quit-application") {
       this.shutdown();
       return;
     }
 
     try {
       // meh, let's just use mark_failure for now.
       // and let's avoid feedback loops (happens in mozmill)
       if ((aMessage instanceof Ci.nsIScriptError) &&
-        (!aMessage.errorMessage.includes("Error console says")))
-        {
-          // Unfortunately changes to mozilla-central are throwing lots
-          // of console errors during testing, so disable (we hope temporarily)
-          // failing on XPCOM console errors (see bug 1014350).
-          // An XPCOM error aMessage looks like this:
-          //   [JavaScript Error: "uncaught exception: 2147500037"]
-          // Capture the number, and allow known XPCOM results.
-          let matches = /exception: (\d+)/.exec(aMessage);
-          let XPCOMresult = null;
-          if (matches) {
-            for (let result in Cr) {
-              if (matches[1] == Cr[result])
-              {
-                XPCOMresult = result;
-                break;
-              }
+          (!aMessage.errorMessage.includes("Error console says"))) {
+        // Unfortunately changes to mozilla-central are throwing lots
+        // of console errors during testing, so disable (we hope temporarily)
+        // failing on XPCOM console errors (see bug 1014350).
+        // An XPCOM error aMessage looks like this:
+        //   [JavaScript Error: "uncaught exception: 2147500037"]
+        // Capture the number, and allow known XPCOM results.
+        let matches = /exception: (\d+)/.exec(aMessage);
+        let XPCOMresult = null;
+        if (matches) {
+          for (let result in Cr) {
+            if (matches[1] == Cr[result]) {
+              XPCOMresult = result;
+              break;
             }
-            let message = XPCOMresult || aMessage;
-            if (logHelperAllowedErrors.some(e => e == matches[1]))
-            {
-              if (XPCOMresult)
-                info("Ignoring XPCOM error: " + message);
-              return;
-            }
-            else
-              info("Found XPCOM error: " + message);
           }
-          mark_failure(["Error console says", aMessage]);
+          let message = XPCOMresult || aMessage;
+          if (logHelperAllowedErrors.some(e => e == matches[1])) {
+            if (XPCOMresult)
+              info("Ignoring XPCOM error: " + message);
+            return;
+          }
+          info("Found XPCOM error: " + message);
         }
-    }
-    catch (ex) {
+        mark_failure(["Error console says", aMessage]);
+      }
+    } catch (ex) {
       // This is to avoid pathological error loops.  we definitely do not
       // want to propagate an error here.
     }
-  }
+  },
 };
 
 // This defaults to undefined and is for use by test-folder-display-helpers
 //  so that it can pre-initialize the value so that when we are evaluated in
 //  its subscript loader we see a value of 'true'.
 var _do_not_wrap_xpcshell;
 
 /**
@@ -193,22 +193,22 @@ function mark_test_start(aName, aParamet
 
   // clear out any existing contexts
   mark_test_end(aDepth);
 
   let term = (aDepth == 0) ? "test" : "subtest";
   _testLoggerActiveContext = _mailnewsTestLogger.newContext({
     type: term,
     name: aName,
-    parameter: aParameter
+    parameter: aParameter,
   });
   if (_testLoggerContexts.length) {
     _testLoggerActiveContext._contextDepth = _testLoggerContexts.length;
     _testLoggerActiveContext._contextParentId =
-      _testLoggerContexts[_testLoggerContexts.length-1]._id;
+      _testLoggerContexts[_testLoggerContexts.length - 1]._id;
   }
   _testLoggerContexts.push(_testLoggerActiveContext);
 
   _mailnewsTestLogger.info(_testLoggerActiveContext,
                            "Starting " + term + ": " + aName +
                            (aParameter ? (", " + aParameter) : ""));
 }
 
@@ -315,31 +315,27 @@ function __simple_obj_copy(aObj, aDepthA
     if (aObj.__lookupGetter__(key)) {
       oot[key] = "*getter*";
       continue;
     }
     let value = aObj[key];
 
     if (value == null) {
       oot[key] = null;
-    }
-    else if (typeof(value) != "object") {
+    } else if (typeof(value) != "object") {
       oot[key] = value;
-    }
-    // steal control flow if no more depth is allowed
-    else if (!aDepthAllowed) {
+    } else if (!aDepthAllowed) {
+      // steal control flow if no more depth is allowed
       oot[key] = "truncated, string rep: " + value.toString();
-    }
-    // array?  (not directly counted, but we will terminate because the
-    //  child copying occurs using nextDepth...)
-    else if (Array.isArray(value)) {
+    } else if (Array.isArray(value)) {
+      // array?  (not directly counted, but we will terminate because the
+      //  child copying occurs using nextDepth...)
       oot[key] = value.map(v => __value_copy(v, nextDepth));
-    }
-    // it's another object! woo!
-    else {
+    } else {
+      // it's another object! woo!
       oot[key] = _normalize_for_json(value, nextDepth, true);
     }
   }
 
   // let's take advantage of the object's native toString now
   oot._stringRep = aObj.toString();
 
   return oot;
@@ -375,26 +371,24 @@ function _normalize_for_json(aObj, aDept
 
   // recursively transform arrays outright
   if (Array.isArray(aObj))
       return aObj.map(v => __value_copy(v, aDepthAllowed - 1));
 
   // === Mail Specific ===
   // (but common and few enough to not split out)
   if (aObj instanceof Ci.nsIMsgFolder) {
-    let flags = aObj.flags;
     return {
       type: "folder",
       name: aObj.prettyName,
       uri: aObj.URI,
       flags: _explode_flags(aObj.flags,
                             Ci.nsMsgFolderFlags),
     };
-  }
-  else if (aObj instanceof Ci.nsIMsgDBHdr) {
+  } else if (aObj instanceof Ci.nsIMsgDBHdr) {
     let properties = {};
     for (let name in _INTERESTING_MESSAGE_HEADER_PROPERTIES) {
       let propType = _INTERESTING_MESSAGE_HEADER_PROPERTIES[name];
       if (propType === 0)
         properties[name] = (aObj.getStringProperty(name) != "") ?
                              aObj.getUint32Property(name) : null;
       else
         properties[name] = aObj.getStringProperty(name);
@@ -406,122 +400,114 @@ function _normalize_for_json(aObj, aDept
       from: aObj.mime2DecodedAuthor,
       to: aObj.mime2DecodedRecipients,
       messageKey: aObj.messageKey,
       messageId: aObj.messageId,
       flags: _explode_flags(aObj.flags,
                             Ci.nsMsgMessageFlags),
       interestingProperties: properties,
     };
-  }
-  // === Generic ===
-  // DOM nodes, including elements
-  else if (Node.isInstance(aObj)) {
+  } else if (Node.isInstance(aObj)) {
+    // === Generic ===
+    // DOM nodes, including elements
     let name = aObj.nodeName;
     let objAttrs = {};
 
     if (Element.isInstance(aObj))
       name += "#" + aObj.getAttribute("id");
 
     if ("attributes" in aObj) {
       let nodeAttrs = aObj.attributes;
       for (let iAttr = 0; iAttr < nodeAttrs.length; iAttr++) {
         objAttrs[nodeAttrs[iAttr].name] = nodeAttrs[iAttr].value;
       }
     }
 
-    let bounds = { left: null, top: null, width: null, height: null }
+    let bounds = { left: null, top: null, width: null, height: null };
     if ("getBoundingClientRect" in aObj)
       bounds = aObj.getBoundingClientRect();
 
     return {
       type: "domNode",
-      name: name,
+      name,
       value: aObj.nodeValue,
       namespace: aObj.namespaceURI,
       boundingClientRect: bounds,
       attrs: objAttrs,
     };
-  }
-  else if (aObj instanceof Ci.nsIDOMWindow) {
+  } else if (aObj instanceof Ci.nsIDOMWindow) {
     let winId, title;
     if (aObj.document && aObj.document.documentElement) {
       title = aObj.document.title;
       winId = aObj.document.documentElement.getAttribute("windowtype") ||
               aObj.document.documentElement.getAttribute("id") ||
               "unnamed";
-    }
-    else {
+    } else {
       winId = "n/a";
       title = "no document";
     }
     return {
       type: "domWindow",
       id: winId,
-      title: title,
+      title,
       location: "" + aObj.location,
       coords: {x: aObj.screenX, y: aObj.screenY},
       dims: {width: aObj.outerWidth, height: aObj.outerHeight},
     };
-  }
-  // Although straight JS exceptions should serialize pretty well, we can
-  //  improve things by making "stack" more friendly.
-  else if (aObj instanceof Error) {
+  } else if (aObj instanceof Error) {
+    // Although straight JS exceptions should serialize pretty well, we can
+    //  improve things by making "stack" more friendly.
     return {
       type: "error",
       message: aObj.message,
       fileName: aObj.fileName,
       lineNumber: aObj.lineNumber,
       name: aObj.name,
       stack: aObj.stack ? aObj.stack.split(/\n\r?/g) : null,
       _stringRep: aObj.message,
     };
-  }
-  else if (aObj instanceof Ci.nsIException) {
+  } else if (aObj instanceof Ci.nsIException) {
     return {
       type: "error",
       message: "nsIException: " + aObj.name,
       fileName: aObj.filename, // intentionally lower-case
       lineNumber: aObj.lineNumber,
       name: aObj.name,
       result: aObj.result,
       stack: null,
     };
-  }
-  else if (aObj instanceof Ci.nsIStackFrame) {
+  } else if (aObj instanceof Ci.nsIStackFrame) {
     return {
       type: "stackFrame",
       name: aObj.name,
       fileName: aObj.filename, // intentionally lower-case
       lineNumber: aObj.lineNumber,
     };
-  }
-  else if (aObj instanceof Ci.nsIScriptError) {
+  } else if (aObj instanceof Ci.nsIScriptError) {
     return {
       type: "stackFrame",
       name: aObj.errorMessage,
       category: aObj.category,
       fileName: aObj.sourceName,
       lineNumber: aObj.lineNumber,
     };
   }
-  else {
-    for (let [checkType, handler] of _registered_json_normalizers) {
-      if (aObj instanceof checkType)
-        return handler(aObj);
-    }
+
+  for (let [checkType, handler] of _registered_json_normalizers) {
+    if (aObj instanceof checkType)
+      return handler(aObj);
+  }
 
-    // Do not fall into simple object walking if this is an XPCOM interface.
-    //  We might run across getters and that leads to nothing good.
-    if (aObj instanceof Ci.nsISupports) {
-      return {
-        type: "XPCOM",
-        name: aObj.toString(),
-      }
-    }
+  // Do not fall into simple object walking if this is an XPCOM interface.
+  // We might run across getters and that leads to nothing good.
+  if (aObj instanceof Ci.nsISupports) {
+    return {
+      type: "XPCOM",
+      name: aObj.toString(),
+    };
   }
 
   let simple_obj = __simple_obj_copy(aObj, aDepthAllowed);
   if (!aJsonMeNotNeeded)
     simple_obj._jsonMe = true;
   return simple_obj;
 }
 
@@ -536,35 +522,35 @@ function register_json_normalizer(aType,
 function _MarkAction(aWho, aWhat, aArgs) {
   this.type = "action";
   this.who = aWho;
   this.what = aWhat;
   this.args = aArgs;
 }
 _MarkAction.prototype = {
   _jsonMe: true,
-  toString: function() {
+  toString() {
     let argStr;
     if (this.args) {
       argStr = ":";
       for (let arg of this.args) {
         if (arg != null && (typeof(arg) == "object") && ("type" in arg)) {
           if ("name" in arg)
             argStr += " " + arg.type + ": " + arg.name;
           else
             argStr += " " + arg.type;
+        } else {
+          argStr += " " + arg;
         }
-        else
-          argStr += " " + arg;
       }
+    } else {
+      argStr = "";
     }
-    else
-      argStr = "";
     return this.who + " " + this.what + argStr;
-  }
+  },
 };
 
 /**
  * Report performance of an action (by testing code).  You would use this rather
  *  than dump because we attempt to do interesting and useful logging things.
  *  In the future, this may mean prettier logs when buildbot runs a test and it
  *  fails, but right now it means great fun for people who use logsploder and
  *  just nicely formatted text for people looking at the console output.
@@ -626,18 +612,17 @@ function _Failure(aText, aStack) {
 function mark_failure(aRichString) {
   let args = [_testLoggerActiveContext];
   let text = "";
   for (let [i, richThing] of aRichString.entries()) {
     text += (i ? " " : "");
     if (richThing == null || typeof(richThing) != "object") {
       text += richThing;
       args.push(richThing);
-    }
-    else {
+    } else {
       let jsonThing = _normalize_for_json(richThing);
       if (("type" in jsonThing) && ("name" in jsonThing))
         text += "[" + jsonThing.type + " " + jsonThing.name + "]";
       else
         text += "[" + jsonThing + "]";
 
       // hook things up to be json serialized.
       if (!("_jsonMe" in jsonThing))
@@ -657,38 +642,12 @@ function _wrapped_do_throw(text, stack) 
   // We need to use an info because otherwise explosion loggers can get angry
   //  and they may be indiscriminate about what they subscribe to.
   _xpcshellLogger.info(_testLoggerActiveContext,
                         new _Failure(text, stack));
 
   return _orig_do_throw(text, stack);
 }
 
-function _wrapped_do_check_neq(left, right, stack) {
-  if (!stack)
-    stack = Components.stack.caller;
-
-  _xpcshellLogger.info(_testLoggerActiveContext,
-                       new _CheckAction(left != right,
-                                        left, right, stack));
-
-  return _orig_do_check_neq(left, right, stack);
-}
-
-function _wrapped_do_check_eq(left, right, stack) {
-  if (!stack)
-    stack = Components.stack.caller;
-
-  _xpcshellLogger.info(_testLoggerActiveContext,
-                       new _CheckAction(left == right,
-                                        left, right, stack));
-
-  return _orig_do_check_eq(left, right, stack);
-}
-
 function _wrap_xpcshell_functions() {
   _orig_do_throw = do_throw;
-  do_throw = _wrapped_do_throw;
-  _orig_do_check_neq = do_check_neq;
-  do_check_neq = _wrapped_do_check_neq;
-  _orig_do_check_eq = do_check_eq;
-  do_check_eq = _wrapped_do_check_eq;
+  do_throw = _wrapped_do_throw; // eslint-disable-line no-global-assign
 }
--- a/mailnews/test/resources/mailShutdown.js
+++ b/mailnews/test/resources/mailShutdown.js
@@ -1,19 +1,23 @@
+/* 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/. */
 
 /* Provides methods to make sure our test shuts down mailnews properly. */
 
+var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+
 // Notifies everyone that the we're shutting down. This is needed to make sure
 // that e.g. the account manager closes and cleans up correctly. It is semi-fake
 // because we don't actually do any work to make sure the profile goes away, but
 // it will mimic the behaviour in the app sufficiently.
 //
 // See also http://developer.mozilla.org/en/Observer_Notifications
-function postShutdownNotifications()
-{
+function postShutdownNotifications() {
   // first give everyone a heads up about us shutting down. if someone wants
   // to cancel this, our test should fail.
   var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
                      .createInstance(Ci.nsISupportsPRBool);
   Services.obs.notifyObservers(cancelQuit, "quit-application-requested");
   if (cancelQuit.data) {
     do_throw("Cannot shutdown: Someone cancelled the quit request!");
   }
@@ -25,16 +29,16 @@ function postShutdownNotifications()
                        "profile-before-change"];
   notifications.forEach(function(notification) {
                           Services.obs.notifyObservers(null, notification);
                         });
 
   // finally, the xpcom-shutdown notification is handled by XPCOM itself.
 }
 
-if (typeof MockFactory != "undefined")
-  MockFactory.unregisterAll();
+if ("MockFactory" in this)
+  this.MockFactory.unregisterAll();
 
 // First do a gc to let anything not being referenced be cleaned up.
 gc();
 
 // Now shut everything down.
 postShutdownNotifications();
--- a/mailnews/test/resources/mailTestUtils.js
+++ b/mailnews/test/resources/mailTestUtils.js
@@ -1,101 +1,92 @@
 /* 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/. */
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
-this.EXPORTED_SYMBOLS = ['mailTestUtils'];
+this.EXPORTED_SYMBOLS = ["mailTestUtils"];
 
 var {ctypes} = ChromeUtils.import("resource://gre/modules/ctypes.jsm");
 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");
 
-var CC = Components.Constructor;
-
 // See Bug 903946
 function avoidUncaughtExceptionInExternalProtocolService() {
   try {
     Services.prefs.setCharPref("helpers.private_mime_types_file",
       Services.prefs.getCharPref("helpers.global_mime_types_file"));
   } catch (ex) {}
   try {
     Services.prefs.setCharPref("helpers.private_mailcap_file",
       Services.prefs.getCharPref("helpers.global_mailcap_file"));
   } catch (ex) {}
 }
 avoidUncaughtExceptionInExternalProtocolService();
 
 var mailTestUtils = {
   // Loads a file to a string
   // If aCharset is specified, treats the file as being of that charset
-  loadFileToString: function(aFile, aCharset) {
+  loadFileToString(aFile, aCharset) {
     var data = "";
     var fstream = Cc["@mozilla.org/network/file-input-stream;1"]
                     .createInstance(Ci.nsIFileInputStream);
     fstream.init(aFile, -1, 0, 0);
 
-    if (aCharset)
-    {
+    if (aCharset) {
       var cstream = Cc["@mozilla.org/intl/converter-input-stream;1"]
                       .createInstance(Ci.nsIConverterInputStream);
       cstream.init(fstream, aCharset, 4096, 0x0000);
-      var str = {};
+      let str = {};
       while (cstream.readString(4096, str) != 0)
         data += str.value;
 
       cstream.close();
-    }
-    else
-    {
+    } else {
       var sstream = Cc["@mozilla.org/scriptableinputstream;1"]
                       .createInstance(Ci.nsIScriptableInputStream);
 
       sstream.init(fstream);
 
-      var str = sstream.read(4096);
+      let str = sstream.read(4096);
       while (str.length > 0) {
         data += str;
         str = sstream.read(4096);
       }
 
       sstream.close();
     }
 
     fstream.close();
 
     return data;
   },
 
   // Loads a message to a string
   // If aCharset is specified, treats the file as being of that charset
-  loadMessageToString: function(aFolder, aMsgHdr, aCharset)
-  {
+  loadMessageToString(aFolder, aMsgHdr, aCharset) {
     var data = "";
-    let reusable = new Object;
+    let reusable = {};
     let bytesLeft = aMsgHdr.messageSize;
     let stream = aFolder.getMsgInputStream(aMsgHdr, reusable);
-    if (aCharset)
-    {
+    if (aCharset) {
       let cstream = Cc["@mozilla.org/intl/converter-input-stream;1"]
                       .createInstance(Ci.nsIConverterInputStream);
       cstream.init(stream, aCharset, 4096, 0x0000);
       let str = {};
       let bytesToRead = Math.min(bytesLeft, 4096);
       while (cstream.readString(bytesToRead, str) != 0) {
         data += str.value;
         bytesLeft -= bytesToRead;
         if (bytesLeft <= 0)
           break;
         bytesToRead = Math.min(bytesLeft, 4096);
       }
       cstream.close();
-    }
-    else
-    {
+    } else {
       var sstream = Cc["@mozilla.org/scriptableinputstream;1"]
                       .createInstance(Ci.nsIScriptableInputStream);
 
       sstream.init(stream);
 
       let bytesToRead = Math.min(bytesLeft, 4096);
       var str = sstream.read(bytesToRead);
       bytesLeft -= bytesToRead;
@@ -109,28 +100,26 @@ var mailTestUtils = {
       }
       sstream.close();
     }
     stream.close();
 
     return data;
   },
 
-  /// Gets the first message header in a folder.
-  firstMsgHdr: function(folder)
-  {
+  // Gets the first message header in a folder.
+  firstMsgHdr(folder) {
     let enumerator = folder.msgDatabase.EnumerateMessages();
     if (enumerator.hasMoreElements())
       return enumerator.getNext().QueryInterface(Ci.nsIMsgDBHdr);
     return null;
   },
 
-  /// Gets message header number N (0 based index) in a folder.
-  getMsgHdrN: function(folder, n)
-  {
+  // Gets message header number N (0 based index) in a folder.
+  getMsgHdrN(folder, n) {
     let i = 0;
     let enumerator = folder.msgDatabase.EnumerateMessages();
     while (enumerator.hasMoreElements()) {
       let next = enumerator.getNext();
       if (i == n)
         return next.QueryInterface(Ci.nsIMsgDBHdr);
       i++;
     }
@@ -139,17 +128,17 @@ var mailTestUtils = {
 
   /**
    * Returns the file system a particular file is on.
    * Currently supported on Windows only.
    *
    * @param aFile The file to get the file system for.
    * @return The file system a particular file is on, or 'null' if not on Windows.
    */
-  get_file_system: function(aFile) {
+  get_file_system(aFile) {
     if (!("@mozilla.org/windows-registry-key;1" in Cc)) {
       dump("get_file_system() is supported on Windows only.\n");
       return null;
     }
 
     // Win32 type and other constants.
     const BOOL = ctypes.int32_t;
     const MAX_PATH = 260;
@@ -200,18 +189,17 @@ var mailTestUtils = {
 
       if (!GetVolumeInformation(volumePath, null, 0, null, null, null, fsName,
                                 fsName.length)) {
         throw new Error("Unable to get volume information for " +
                         volumePath.readString() + ", error " + ctypes.winLastError);
       }
 
       return fsName.readString();
-    }
-    finally {
+    } finally {
       kernel32.close();
     }
   },
 
   /**
    * Try marking a region of a file as sparse, so that zeros don't consume
    * significant amounts of disk space.  This is a platform-dependent routine and
    * is not supported on all platforms. The current status of this function is:
@@ -225,17 +213,17 @@ var mailTestUtils = {
    * @param aRegionBytes The number of bytes to mark as sparse.
    * @return Whether the OS and file system supports marking files as sparse. If
    *          this is true, then the file has been marked as sparse. If this is
    *          false, then the underlying system doesn't support marking files as
    *          sparse. If an exception is thrown, then the system does support
    *          marking files as sparse, but an error occurred while doing so.
    *
    */
-  mark_file_region_sparse: function(aFile, aRegionStart, aRegionBytes) {
+  mark_file_region_sparse(aFile, aRegionStart, aRegionBytes) {
     let fileSystem = this.get_file_system(aFile);
     dump("[mark_file_region_sparse()] File system = " + (fileSystem || "(unknown)") +
            ", file region = at " + this.toMiBString(aRegionStart) +
            " for " + this.toMiBString(aRegionBytes) + "\n");
 
     if ("@mozilla.org/windows-registry-key;1" in Cc) {
       // On Windows, check whether the drive is NTFS. If it is, proceed.
       // If it isn't, then bail out now, because in all probability it is
@@ -359,72 +347,67 @@ var mailTestUtils = {
             ctypes.winapi_abi,
             BOOL,  // return type: 1 indicates success, 0 failure
             HANDLE // in: hFile
           );
           if (!SetEndOfFile(hFile))
             throw new Error("Unable to set end of file, error " + ctypes.winLastError);
 
           return true;
-        }
-        finally {
+        } finally {
           let CloseHandle = kernel32.declare(
             "CloseHandle",
             ctypes.winapi_abi,
             BOOL,  // return type: 1 indicates success, 0 failure
             HANDLE // in: hObject
           );
           CloseHandle(hFile);
         }
-      }
-      finally {
+      } finally {
         kernel32.close();
       }
-    }
-    else if ("nsILocalFileMac" in Ci) {
+    } else if ("nsILocalFileMac" in Ci) {
       // Macs don't support marking files as sparse.
       return false;
-    }
-    else {
+    } else {
       // Assuming Unix here. Unix file systems generally automatically sparsify
       // files.
       return true;
     }
   },
 
   /**
    * Converts a size in bytes into its mebibytes string representation.
    * NB: 1 MiB = 1024 * 1024 = 1048576 B.
    *
    * @param aSize The size in bytes.
    * @return A string representing the size in medibytes.
    */
-  toMiBString: function(aSize) {
+  toMiBString(aSize) {
     return (aSize / 1048576) + " MiB";
   },
 
   /**
    * A variant of do_timeout that accepts an actual function instead of
    *  requiring you to pass a string to evaluate.  If the function throws an
    *  exception when invoked, we will use do_throw to ensure that the test fails.
    *
    * @param aDelayInMS The number of milliseconds to wait before firing the timer.
    * @param aFunc The function to invoke when the timer fires.
    * @param aFuncThis Optional 'this' pointer to use.
    * @param aFuncArgs Optional list of arguments to pass to the function.
    */
   _timer: null,
-  do_timeout_function: function(aDelayInMS, aFunc, aFuncThis, aFuncArgs) {
+  do_timeout_function(aDelayInMS, aFunc, aFuncThis, aFuncArgs) {
     this._timer = Cc["@mozilla.org/timer;1"]
                     .createInstance(Ci.nsITimer);
     let wrappedFunc = function() {
       try {
         aFunc.apply(aFuncThis, aFuncArgs);
-      }
-      catch (ex) {
+      } catch (ex) {
         // we want to make sure that if the thing we call throws an exception,
         //  that this terminates the test.
         do_throw(ex);
       }
     };
     this._timer.initWithCallback(wrappedFunc, aDelayInMS,
       Ci.nsITimer.TYPE_ONE_SHOT);
   },
@@ -442,38 +425,38 @@ var mailTestUtils = {
    *     if your callback does not rely on 'this'.
    * @param aCallbackArgs A list of arguments to pass to the callback via apply.
    *     If you provide [1,2,3], we will effectively call:
    *     aCallbackThis.aCallback(1,2,3);
    * @param [aSomeoneElseWillTriggerTheUpdate=false] If this is true, we do not
    *     trigger the updateFolder call and it is assumed someone else is taking
    *     care of that.
    */
-  updateFolderAndNotify: function(aFolder, aCallback, aCallbackThis,
-      aCallbackArgs, aSomeoneElseWillTriggerTheUpdate) {
+  updateFolderAndNotify(aFolder, aCallback, aCallbackThis,
+                        aCallbackArgs, aSomeoneElseWillTriggerTheUpdate) {
     // register for the folder loaded notification ahead of time... even though
     //  we may not need it...
     let folderListener = {
-      OnItemEvent: function (aEventFolder, aEvent) {
+      OnItemEvent(aEventFolder, aEvent) {
         if (aEvent == "FolderLoaded" && aFolder.URI == aEventFolder.URI) {
           MailServices.mailSession.RemoveFolderListener(this);
           aCallback.apply(aCallbackThis, aCallbackArgs);
         }
-      }
+      },
     };
 
     MailServices.mailSession.AddFolderListener(folderListener, Ci.nsIFolderListener.event);
 
     if (!aSomeoneElseWillTriggerTheUpdate)
       aFolder.updateFolder(null);
   },
 
   /**
    * For when you want to compare elements non-strictly.
    */
-  non_strict_index_of: function(aArray, aElem) {
+  non_strict_index_of(aArray, aElem) {
     for (let [i, elem] of aArray.entries()) {
       if (elem == aElem)
         return i;
     }
     return -1;
-  }
+  },
 };
--- a/mailnews/test/resources/messageGenerator.js
+++ b/mailnews/test/resources/messageGenerator.js
@@ -1,38 +1,38 @@
 /* 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/. */
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
-this.EXPORTED_SYMBOLS = ['MessageGenerator'];
+this.EXPORTED_SYMBOLS = ["MessageGenerator"];
 
 /**
  * A list of first names for use by MessageGenerator to create deterministic,
  *  reversible names.  To keep things easily reversible, if you add names, make
  *  sure they have no spaces in them!
  */
 var FIRST_NAMES = [
   "Andy", "Bob", "Chris", "David", "Emily", "Felix",
   "Gillian", "Helen", "Idina", "Johnny", "Kate", "Lilia",
   "Martin", "Neil", "Olof", "Pete", "Quinn", "Rasmus",
   "Sarah", "Troels", "Ulf", "Vince", "Will", "Xavier",
-  "Yoko", "Zig"
+  "Yoko", "Zig",
   ];
 
 /**
  * A list of last names for use by MessageGenerator to create deterministic,
  *  reversible names.  To keep things easily reversible, if you add names, make
  *  sure they have no spaces in them!
  */
 var LAST_NAMES = [
   "Anway", "Bell", "Clarke", "Davol", "Ekberg", "Flowers",
   "Gilbert", "Hook", "Ivarsson", "Jones", "Kurtz", "Lowe",
   "Morris", "Nagel", "Orzabal", "Price", "Quinn", "Rolinski",
   "Stanley", "Tennant", "Ulvaeus", "Vannucci", "Wiggs", "Xavier",
-  "Young", "Zig"
+  "Young", "Zig",
   ];
 
 /**
  * A list of adjectives used to construct a deterministic, reversible subject
  *  by MessageGenerator.  To keep things easily reversible, if you add more,
  *  make sure they have no spaces in them!  Also, make sure your additions
  *  don't break the secret Monty Python reference!
  */
@@ -94,51 +94,51 @@ function SyntheticPart(aProperties) {
 }
 SyntheticPart.prototype = {
   _forceDisposition: null,
   _encoding: null,
 
   get contentTypeHeaderValue() {
     let s = this._contentType;
     if (this._charset)
-      s += '; charset=' + this._charset;
+      s += "; charset=" + this._charset;
     if (this._format)
-      s += '; format=' + this._format;
+      s += "; format=" + this._format;
     if (this._filename)
-      s += ';\r\n name="' + this._filename +'"';
+      s += ';\r\n name="' + this._filename + '"';
     if (this._contentTypeExtra) {
       for (let [key, value] of Object.entries(this._contentTypeExtra))
-        s += ';\r\n ' + key + '="' + value + '"';
+        s += ";\r\n " + key + '="' + value + '"';
     }
     if (this._boundary)
       s += ';\r\n boundary="' + this._boundary + '"';
     return s;
   },
   get hasTransferEncoding() {
     return this._encoding;
   },
   get contentTransferEncodingHeaderValue() {
     return this._encoding;
   },
   get hasDisposition() {
     return this._forceDisposition || this._filename || false;
   },
   get contentDispositionHeaderValue() {
-    let s = '';
+    let s = "";
     if (this._forceDisposition)
       s += this._forceDisposition;
     else if (this._filename)
       s += 'attachment;\r\n filename="' + this._filename + '"';
     return s;
   },
   get hasContentId() {
     return this._contentId || false;
   },
   get contentIdHeaderValue() {
-    return '<' + this._contentId + '>';
+    return "<" + this._contentId + ">";
   },
   get hasExtraHeaders() {
     return this._extraHeaders || false;
   },
   get extraHeaders() {
     return this._extraHeaders || false;
   },
 };
@@ -147,181 +147,181 @@ SyntheticPart.prototype = {
  * Leaf MIME part, defaulting to text/plain.
  */
 function SyntheticPartLeaf(aBody, aProperties) {
   SyntheticPart.call(this, aProperties);
   this.body = aBody;
 }
 SyntheticPartLeaf.prototype = {
   __proto__: SyntheticPart.prototype,
-  _contentType: 'text/plain',
-  _charset: 'ISO-8859-1',
-  _format: 'flowed',
-  _encoding: '7bit',
-  toMessageString: function() {
+  _contentType: "text/plain",
+  _charset: "ISO-8859-1",
+  _format: "flowed",
+  _encoding: "7bit",
+  toMessageString() {
     return this.body;
   },
-  prettyString: function MimeMessage_prettyString(aIndent) {
+  prettyString(aIndent) {
     return "Leaf: " + this._contentType;
   },
 };
 
 /**
  * A part that tells us to produce NO output in a multipart section.  So if our
  *  separator is "--BOB", we might produce "--BOB\n--BOB--\n" instead of having
  *  some headers and actual content in there.
  * This is not a good idea and probably not legal either, but it happens and
  *  we need to test for it.
  */
 function SyntheticDegeneratePartEmpty() {
 }
 SyntheticDegeneratePartEmpty.prototype = {
-  prettyString: function SyntheticDegeneratePartEmpty_prettyString(aIndent) {
+  prettyString(aIndent) {
     return "Degenerate Empty Part";
-  }
+  },
 };
 
 /**
  * Multipart (multipart/*) MIME part base class.
  */
 function SyntheticPartMulti(aParts, aProperties) {
   SyntheticPart.call(this, aProperties);
 
-  this._boundary = '--------------CHOPCHOP' + this.BOUNDARY_COUNTER;
+  this._boundary = "--------------CHOPCHOP" + this.BOUNDARY_COUNTER;
   this.BOUNDARY_COUNTER_HOME.BOUNDARY_COUNTER += 1;
   this.parts = (aParts != null) ? aParts : [];
 }
 SyntheticPartMulti.prototype = {
   __proto__: SyntheticPart.prototype,
   BOUNDARY_COUNTER: 0,
-  toMessageString: function() {
+  toMessageString() {
     let s = "This is a multi-part message in MIME format.\r\n";
     for (let part of this.parts) {
       s += "--" + this._boundary + "\r\n";
       if (part instanceof SyntheticDegeneratePartEmpty)
         continue;
-      s += "Content-Type: " + part.contentTypeHeaderValue + '\r\n';
+      s += "Content-Type: " + part.contentTypeHeaderValue + "\r\n";
       if (part.hasTransferEncoding)
-        s += 'Content-Transfer-Encoding: ' +
-             part.contentTransferEncodingHeaderValue + '\r\n';
+        s += "Content-Transfer-Encoding: " +
+             part.contentTransferEncodingHeaderValue + "\r\n";
       if (part.hasDisposition)
-        s += 'Content-Disposition: ' + part.contentDispositionHeaderValue +
-             '\r\n';
+        s += "Content-Disposition: " + part.contentDispositionHeaderValue +
+             "\r\n";
       if (part.hasContentId)
-        s += 'Content-ID: ' + part.contentIdHeaderValue + '\r\n';
+        s += "Content-ID: " + part.contentIdHeaderValue + "\r\n";
       if (part.hasExtraHeaders)
         for (let k in part.extraHeaders) {
           let v = part.extraHeaders[k];
-          s += k + ': ' + v + '\r\n';
+          s += k + ": " + v + "\r\n";
         }
-      s += '\r\n';
-      s += part.toMessageString() + '\r\n\r\n';
+      s += "\r\n";
+      s += part.toMessageString() + "\r\n\r\n";
     }
-    s += "--" + this._boundary + '--';
+    s += "--" + this._boundary + "--";
     return s;
   },
-  prettyString: function(aIndent) {
+  prettyString(aIndent) {
     let nextIndent = (aIndent != null) ? (aIndent + "  ") : "";
 
     let s = "Container: " + this._contentType;
 
     for (let iPart = 0; iPart < this.parts.length; iPart++) {
       let part = this.parts[iPart];
-      s += "\n" + nextIndent + (iPart+1) + " " + part.prettyString(nextIndent);
+      s += "\n" + nextIndent + (iPart + 1) + " " + part.prettyString(nextIndent);
     }
 
     return s;
-  }
+  },
 };
 SyntheticPartMulti.prototype.BOUNDARY_COUNTER_HOME = SyntheticPartMulti.prototype;
 
 /**
  * Multipart mixed (multipart/mixed) MIME part.
  */
 function SyntheticPartMultiMixed(...aArgs) {
   SyntheticPartMulti.apply(this, aArgs);
 }
 SyntheticPartMultiMixed.prototype = {
   __proto__: SyntheticPartMulti.prototype,
-  _contentType: 'multipart/mixed',
+  _contentType: "multipart/mixed",
 };
 
 /**
  * Multipart mixed (multipart/mixed) MIME part.
  */
 function SyntheticPartMultiParallel(...aArgs) {
   SyntheticPartMulti.apply(this, aArgs);
 }
 SyntheticPartMultiParallel.prototype = {
   __proto__: SyntheticPartMulti.prototype,
-  _contentType: 'multipart/parallel',
+  _contentType: "multipart/parallel",
 };
 
 /**
  * Multipart digest (multipart/digest) MIME part.
  */
 function SyntheticPartMultiDigest(...aArgs) {
   SyntheticPartMulti.apply(this, aArgs);
 }
 SyntheticPartMultiDigest.prototype = {
   __proto__: SyntheticPartMulti.prototype,
-  _contentType: 'multipart/digest',
+  _contentType: "multipart/digest",
 };
 
 /**
  * Multipart alternative (multipart/alternative) MIME part.
  */
 function SyntheticPartMultiAlternative(...aArgs) {
   SyntheticPartMulti.apply(this, aArgs);
 }
 SyntheticPartMultiAlternative.prototype = {
   __proto__: SyntheticPartMulti.prototype,
-  _contentType: 'multipart/alternative',
+  _contentType: "multipart/alternative",
 };
 
 /**
  * Multipart related (multipart/related) MIME part.
  */
 function SyntheticPartMultiRelated(...aArgs) {
   SyntheticPartMulti.apply(this, aArgs);
 }
 SyntheticPartMultiRelated.prototype = {
   __proto__: SyntheticPartMulti.prototype,
-  _contentType: 'multipart/related',
+  _contentType: "multipart/related",
 };
 
-var PKCS_SIGNATURE_MIME_TYPE = 'application/x-pkcs7-signature';
+var PKCS_SIGNATURE_MIME_TYPE = "application/x-pkcs7-signature";
 /**
  * Multipart signed (multipart/signed) SMIME part.  This is helperish and makes
  *  up a gibberish signature.  We wrap the provided parts in the standard
  *  signature idiom
  *
  * @param aPart The content part to wrap. Only one part!  Use a multipart if
  *     you need to cram extra stuff in there.
  * @param aProperties Properties, propagated to SyntheticPart, see that.
  */
 function SyntheticPartMultiSignedSMIME(aPart, aProperties) {
   SyntheticPartMulti.call(this, [aPart], aProperties);
   this.parts.push(new SyntheticPartLeaf(
     "I am not really a signature but let's hope no one figures it out.",
     {
       contentType: PKCS_SIGNATURE_MIME_TYPE,
-      name: 'smime.p7s',
+      name: "smime.p7s",
     }));
 }
 SyntheticPartMultiSignedSMIME.prototype = {
   __proto__: SyntheticPartMulti.prototype,
-  _contentType: 'multipart/signed',
+  _contentType: "multipart/signed",
   _contentTypeExtra: {
     protocol: PKCS_SIGNATURE_MIME_TYPE,
-    micalg: 'SHA1'
+    micalg: "SHA1",
   },
 };
 
-var PGP_SIGNATURE_MIME_TYPE = 'application/pgp-signature';
+var PGP_SIGNATURE_MIME_TYPE = "application/pgp-signature";
 /**
  * Multipart signed (multipart/signed) PGP part.  This is helperish and makes
  *  up a gibberish signature.  We wrap the provided parts in the standard
  *  signature idiom
  *
  * @param aPart The content part to wrap. Only one part!  Use a multipart if
  *     you need to cram extra stuff in there.
  * @param aProperties Properties, propagated to SyntheticPart, see that.
@@ -331,20 +331,20 @@ function SyntheticPartMultiSignedPGP(aPa
   this.parts.push(new SyntheticPartLeaf(
     "I am not really a signature but let's hope no one figures it out.",
     {
       contentType: PGP_SIGNATURE_MIME_TYPE,
     }));
 }
 SyntheticPartMultiSignedPGP.prototype = {
   __proto__: SyntheticPartMulti.prototype,
-  _contentType: 'multipart/signed',
+  _contentType: "multipart/signed",
   _contentTypeExtra: {
     protocol: PGP_SIGNATURE_MIME_TYPE,
-    micalg: 'pgp-sha1'
+    micalg: "pgp-sha1",
   },
 };
 
 
 var _DEFAULT_META_STATES = {
   junk: false,
   read: false,
 };
@@ -373,17 +373,17 @@ function SyntheticMessage(aHeaders, aBod
     let value = _DEFAULT_META_STATES[key];
     if (!(key in this.metaState))
       this.metaState[key] = value;
   }
 }
 
 SyntheticMessage.prototype = {
   __proto__: SyntheticPart.prototype,
-  _contentType: 'message/rfc822',
+  _contentType: "message/rfc822",
   _charset: null,
   _format: null,
   _encoding: null,
 
   /** @returns the Message-Id header value. */
   get messageId() { return this._messageId; },
   /**
    * Sets the Message-Id header value.
@@ -401,57 +401,57 @@ SyntheticMessage.prototype = {
   /**
    * Sets the Date header to the given javascript Date object.
    *
    * @param aDate The date you want the message to claim to be from.
    */
   set date(aDate) {
     this._date = aDate;
     let dateParts = aDate.toString().split(" ");
-    this.headers["Date"] = dateParts[0] + ", " + dateParts[2] + " " +
-                           dateParts[1] + " " + dateParts[3] + " " +
-                           dateParts[4] + " " + dateParts[5].substring(3);
+    this.headers.Date = dateParts[0] + ", " + dateParts[2] + " " +
+                        dateParts[1] + " " + dateParts[3] + " " +
+                        dateParts[4] + " " + dateParts[5].substring(3);
   },
 
   /** @returns the message subject */
   get subject() { return this._subject; },
   /**
    * Sets the message subject.
    *
    * @param aSubject A string sans newlines or other illegal characters.
    */
   set subject(aSubject) {
     this._subject = aSubject;
-    this.headers["Subject"] = aSubject;
+    this.headers.Subject = aSubject;
   },
 
   /**
    * Given a tuple containing [a display name, an e-mail address], returns a
    *  string suitable for use in a to/from/cc header line.
    *
    * @param aNameAndAddress A list with two elements.  The first should be the
    *     display name (sans wrapping quotes).  The second element should be the
    *     e-mail address (sans wrapping greater-than/less-than).
    */
-  _formatMailFromNameAndAddress: function(aNameAndAddress) {
+  _formatMailFromNameAndAddress(aNameAndAddress) {
     // if the name is encoded, do not put it in quotes!
-    return (aNameAndAddress[0].startsWith("=") ?
-              (aNameAndAddress[0] + " ") :
-              ('"' + aNameAndAddress[0] + '" ')) +
-           '<' + aNameAndAddress[1] + '>';
+    if (aNameAndAddress[0].startsWith("=")) {
+      return aNameAndAddress[0] + " <" + aNameAndAddress[1] + ">";
+    }
+    return '"' + aNameAndAddress[0] + '" <' + aNameAndAddress[1] + ">";
   },
 
   /**
    * Given a mailbox, parse out name and email. The mailbox
    * can (per rfc 2822) be of two forms:
    *  1) Name <me@example.org>
    *  2) me@example.org
    * @return a tuple of name, email
    **/
-  _parseMailbox: function(mailbox) {
+  _parseMailbox(mailbox) {
     let matcher = mailbox.match(/(.*)<(.+@.+)>/);
     if (!matcher) // no match -> second form
       return ["", mailbox];
 
     let name = matcher[1].trim();
     let email = matcher[2].trim();
     return [name, email];
   },
@@ -465,36 +465,36 @@ SyntheticMessage.prototype = {
    * @param aNameAndAddress A list with two elements.  The first should be the
    *     display name (sans wrapping quotes).  The second element should be the
    *     e-mail address (sans wrapping greater-than/less-than).
    *     Can also be a string, should then be a valid raw From: header value.
    */
   set from(aNameAndAddress) {
     if (typeof aNameAndAddress === "string") {
       this._from = this._parseMailbox(aNameAndAddress);
-      this.headers["From"] = aNameAndAddress;
+      this.headers.From = aNameAndAddress;
       return;
     }
     this._from = aNameAndAddress;
-    this.headers["From"] = this._formatMailFromNameAndAddress(aNameAndAddress);
+    this.headers.From = this._formatMailFromNameAndAddress(aNameAndAddress);
   },
 
   /** @returns The display name part of the From header. */
   get fromName() { return this._from[0]; },
   /** @returns The e-mail address part of the From header (no display name). */
   get fromAddress() { return this._from[1]; },
 
   /**
    * For our header storage, we may need to pre-add commas, this does it.
    *
    * @param aList A list of strings that is mutated so that every string in the
    *     list except the last one has a comma appended to it.
    */
-  _commaize: function(aList) {
-    for (let i=0; i < aList.length - 1; i++)
+  _commaize(aList) {
+    for (let i = 0; i < aList.length - 1; i++)
       aList[i] = aList[i] + ",";
     return aList;
   },
 
   /**
    * @returns the comma-ized list of name-and-address tuples used to set the To
    *     header.
    */
@@ -512,22 +512,23 @@ SyntheticMessage.prototype = {
   set to(aNameAndAddresses) {
     if (typeof aNameAndAddresses === "string") {
       this._to = [];
       let people = aNameAndAddresses.split(",");
       for (let i = 0; i < people.length; i++) {
         this._to.push(this._parseMailbox(people[i]));
       }
 
-      this.headers["To"] = aNameAndAddresses;
+      this.headers.To = aNameAndAddresses;
       return;
     }
     this._to = aNameAndAddresses;
-    this.headers["To"] = this._commaize(aNameAndAddresses.
-      map(nameAndAddr => this._formatMailFromNameAndAddress(nameAndAddr)));
+    this.headers.To = this._commaize(aNameAndAddresses.map(
+      nameAndAddr => this._formatMailFromNameAndAddress(nameAndAddr)
+    ));
   },
   /** @returns The display name of the first intended recipient. */
   get toName() { return this._to[0][0]; },
   /** @returns The email address (no display name) of the first recipient. */
   get toAddress() { return this._to[0][1]; },
 
   /**
    * @returns The comma-ized list of name-and-address tuples used to set the Cc
@@ -546,22 +547,23 @@ SyntheticMessage.prototype = {
    */
   set cc(aNameAndAddresses) {
     if (typeof aNameAndAddresses === "string") {
       this._cc = [];
       let people = aNameAndAddresses.split(",");
       for (let i = 0; i < people.length; i++) {
         this._cc.push(this._parseMailbox(people[i]));
       }
-      this.headers["Cc"] = aNameAndAddresses;
+      this.headers.Cc = aNameAndAddresses;
       return;
     }
     this._cc = aNameAndAddresses;
-    this.headers["Cc"] = this._commaize(aNameAndAddresses.
-      map(nameAndAddr => this._formatMailFromNameAndAddress(nameAndAddr)));
+    this.headers.Cc = this._commaize(aNameAndAddresses.map(
+      nameAndAddr => this._formatMailFromNameAndAddress(nameAndAddr)
+    ));
   },
 
   get bodyPart() {
     return this._bodyPart;
   },
   set bodyPart(aBodyPart) {
     this._bodyPart = aBodyPart;
     this.headers["Content-Type"] = this._bodyPart.contentTypeHeaderValue;
@@ -569,98 +571,97 @@ SyntheticMessage.prototype = {
 
   /**
    * Normalizes header values, which may be strings or arrays of strings, into
    *  a suitable string suitable for appending to the header name/key.
    *
    * @returns a normalized string representation of the header value(s), which
    *     may include spanning multiple lines.
    */
-  _formatHeaderValues: function(aHeaderValues) {
+  _formatHeaderValues(aHeaderValues) {
     // may not be an array
     if (!(aHeaderValues instanceof Array))
       return aHeaderValues;
     // it's an array!
     if (aHeaderValues.length == 1)
       return aHeaderValues[0];
     return aHeaderValues.join("\r\n\t");
   },
 
   /**
    * @returns a string uniquely identifying this message, at least as long as
    *     the messageId is set and unique.
    */
-  toString: function() {
+  toString() {
     return "msg:" + this._messageId;
   },
 
   /**
    * Convert the message and its hierarchy into a "pretty string".  The message
    *  and each MIME part get their own line.  The string never ends with a
    *  newline.  For a non-multi-part message, only a single line will be
    *  returned.
    * Messages have their subject displayed, everyone else just shows their
    *  content type.
    */
-  prettyString: function MimeMessage_prettyString(aIndent) {
+  prettyString(aIndent) {
     if (aIndent === undefined)
       aIndent = "";
     let nextIndent = aIndent + "  ";
 
     let s = "Message: " + this.subject;
     s += "\n" + nextIndent + "1 " + this.bodyPart.prettyString(nextIndent);
 
     return s;
   },
 
   /**
    * @returns this messages in rfc822 format, or something close enough.
    */
-  toMessageString: function() {
+  toMessageString() {
     let lines = Object.keys(this.headers).
       map(headerKey =>
           headerKey + ": " + this._formatHeaderValues(this.headers[headerKey]));
 
     return lines.join("\r\n") + "\r\n\r\n" + this.bodyPart.toMessageString() +
       "\r\n";
   },
 
-  toMboxString: function() {
+  toMboxString() {
     return "From " + this._from[1] + "\r\n" + this.toMessageString() + "\r\n";
   },
 
   /**
    * @returns this message in rfc822 format in a string stream.
    */
-  toStream: function () {
+  toStream() {
     let stream = Cc["@mozilla.org/io/string-input-stream;1"]
                    .createInstance(Ci.nsIStringInputStream);
     let str = this.toMessageString();
     stream.setData(str, str.length);
     return stream;
   },
 
   /**
    * Writes this message to an mbox stream.  This means adding a "From " line
    *  and making sure we've got a trailing newline.
    */
-  writeToMboxStream: function (aStream) {
+  writeToMboxStream(aStream) {
     let str = this.toMboxString();
     aStream.write(str, str.length);
-  }
+  },
 };
 
 /**
  * Write a list of messages to a folder
  *
  * @param aMessages The list of SyntheticMessages instances to write.
  * @param aFolder The folder to write to.
  */
-function addMessagesToFolder (aMessages, aFolder)
-{
+function addMessagesToFolder(aMessages, aFolder) {
   let localFolder = aFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
   for (let message of aMessages)
     localFolder.addMessage(message.toMboxString());
 }
 
 /**
  * Provides mechanisms for creating vaguely interesting, but at least valid,
  *  SyntheticMessage instances.
@@ -692,17 +693,17 @@ MessageGenerator.prototype = {
    *  value.  Currently up to 26*26 unique names can be generated, which
    *  should be sufficient for testing purposes, but if your code cares, check
    *  against MAX_VALID_NAMES.
    *
    * @param aNameNumber The 'number' of the name you want which must be less
    *     than MAX_VALID_NAMES.
    * @returns The unique name corresponding to the name number.
    */
-  makeName: function(aNameNumber) {
+  makeName(aNameNumber) {
     let iFirst = aNameNumber % FIRST_NAMES.length;
     let iLast = (iFirst + Math.floor(aNameNumber / FIRST_NAMES.length)) %
                 LAST_NAMES.length;
 
     return FIRST_NAMES[iFirst] + " " + LAST_NAMES[iLast];
   },
 
   /**
@@ -710,17 +711,17 @@ MessageGenerator.prototype = {
    *  a unique value; intended to work in parallel with makeName.  Currently
    *  up to 26*26 unique addresses can be generated, but if your code cares,
    *  check against MAX_VALID_MAIL_ADDRESSES.
    *
    * @param aNameNumber The 'number' of the mail address you want which must be
    *     less than MAX_VALID_MAIL_ADDRESSES.
    * @returns The unique name corresponding to the name mail address.
    */
-  makeMailAddress: function(aNameNumber) {
+  makeMailAddress(aNameNumber) {
     let iFirst = aNameNumber % FIRST_NAMES.length;
     let iLast = (iFirst + Math.floor(aNameNumber / FIRST_NAMES.length)) %
                 LAST_NAMES.length;
 
     return FIRST_NAMES[iFirst].toLowerCase() + "@" +
            LAST_NAMES[iLast].toLowerCase() + ".invalid";
   },
 
@@ -734,47 +735,47 @@ MessageGenerator.prototype = {
    *     unless you don't mind or can ensure no collisions occur between our
    *     number allocation and your uses.  If provided, the number must be
    *     less than MAX_VALID_NAMES.
    * @return A list containing two elements.  The first is a name produced by
    *     a call to makeName, and the second an e-mail address produced by a
    *     call to makeMailAddress.  This representation is used by the
    *     SyntheticMessage class when dealing with names and addresses.
    */
-  makeNameAndAddress: function(aNameNumber) {
+  makeNameAndAddress(aNameNumber) {
     if (aNameNumber === undefined)
       aNameNumber = this._nextNameNumber++;
     return [this.makeName(aNameNumber), this.makeMailAddress(aNameNumber)];
   },
 
   /**
    * Generate and return multiple pairs of names and e-mail addresses.  The
    *  names are allocated using the automatic mechanism as documented on
    *  makeNameAndAddress.  You should accordingly not allocate / hard code name
    *  numbers on your own.
    *
    * @param aCount The number of people you want name and address tuples for.
    * @returns a list of aCount name-and-address tuples.
    */
-  makeNamesAndAddresses: function(aCount) {
+  makeNamesAndAddresses(aCount) {
     let namesAndAddresses = [];
-    for (let i=0; i < aCount; i++)
+    for (let i = 0; i < aCount; i++)
       namesAndAddresses.push(this.makeNameAndAddress());
     return namesAndAddresses;
   },
 
   /**
    * Generate a consistently determined (and reversible) subject from a unique
    *  value.  Up to MAX_VALID_SUBJECTS can be produced.
    *
    * @param aSubjectNumber The subject number you want generated, must be less
    *     than MAX_VALID_SUBJECTS.
    * @returns The subject corresponding to the given subject number.
    */
-  makeSubject: function(aSubjectNumber) {
+  makeSubject(aSubjectNumber) {
     if (aSubjectNumber === undefined)
       aSubjectNumber = this._nextSubjectNumber++;
     let iAdjective = aSubjectNumber % SUBJECT_ADJECTIVES.length;
     let iNoun = (iAdjective + Math.floor(aSubjectNumber /
                                          SUBJECT_ADJECTIVES.length)) %
                 SUBJECT_NOUNS.length;
     let iSuffix = (iNoun + Math.floor(aSubjectNumber /
                    (SUBJECT_ADJECTIVES.length * SUBJECT_NOUNS.length))) %
@@ -789,32 +790,32 @@ MessageGenerator.prototype = {
    *  we don't use the message yet, in theory it would let us tailor the
    *  message id to the server that theoretically might be sending it.  Or some
    *  such.
    *
    * @param The synthetic message you would like us to make up a message-id for.
    *     We don't set the message-id on the message, that's up to you.
    * @returns a Message-id suitable for the given message.
    */
-  makeMessageId: function(aSynthMessage) {
+  makeMessageId(aSynthMessage) {
     let msgId = this._nextMessageIdNum + "@made.up.invalid";
     this._nextMessageIdNum++;
     return msgId;
   },
 
   /**
    * Generates a valid date which is after all previously issued dates by this
    *  method, ensuring an apparent ordering of time consistent with the order
    *  in which code is executed / messages are generated.
    * If you need a precise time ordering or precise times, make them up
    *  yourself.
    *
    * @returns A made-up time in JavaScript Date object form.
    */
-  makeDate: function() {
+  makeDate() {
     let date = this._clock;
     // advance time by an hour
     this._clock = new Date(date.valueOf() + 60 * 60 * 1000);
     return date;
   },
 
   /**
    * Create a SyntheticMessage.  All arguments are optional, but allow
@@ -863,17 +864,17 @@ MessageGenerator.prototype = {
    *     mechanism.
    * @param [aArgs.junk] Should this message be flagged as junk for the benefit
    *     of the messageInjection helper so that it can know to flag the message
    *     as junk?  We have no concept of marking a message as definitely not
    *     junk at this point.
    * @param [aArgs.read] Should this message be marked as already read?
    * @returns a SyntheticMessage fashioned just to your liking.
    */
-  makeMessage: function(aArgs) {
+  makeMessage(aArgs) {
     aArgs = aArgs || {};
     let msg = new SyntheticMessage();
 
     if (aArgs.inReplyTo) {
       // If inReplyTo is a SyntheticMessageSet, just use the first message in
       //  the set because the caller may be using them.
       let srcMsg = aArgs.inReplyTo.synMessages ?
                      aArgs.inReplyTo.synMessages[0] :
@@ -887,20 +888,19 @@ MessageGenerator.prototype = {
       if (aArgs.replyAll)
         msg.to = [srcMsg.from].concat(srcMsg.to.slice(1));
       else
         msg.to = [srcMsg.from];
       msg.from = srcMsg.to[0];
 
       // we want the <>'s.
       msg.headers["In-Reply-To"] = srcMsg.headers["Message-Id"];
-      msg.headers["References"] = (srcMsg.headers["References"] || []).concat(
-                                   [srcMsg.headers["Message-Id"]]);
-    }
-    else {
+      msg.headers.References = (srcMsg.headers.References || [])
+                               .concat([srcMsg.headers["Message-Id"]]);
+    } else {
       msg.parent = null;
 
       msg.subject = aArgs.subject || this.makeSubject();
       msg.from = aArgs.from || this.makeNameAndAddress();
       msg.to = aArgs.to || this.makeNamesAndAddresses(aArgs.toCount || 1);
       if (aArgs.cc)
         msg.cc = aArgs.cc;
     }
@@ -915,18 +915,17 @@ MessageGenerator.prototype = {
         ts -= age.minutes * 60 * 1000;
       if (age.hours)
         ts -= age.hours * 60 * 60 * 1000;
       if (age.days)
         ts -= age.days * 24 * 60 * 60 * 1000;
       if (age.weeks)
         ts -= age.weeks * 7 * 24 * 60 * 60 * 1000;
       msg.date = new Date(ts);
-    }
-    else {
+    } else {
       msg.date = this.makeDate();
     }
 
     if ("clobberHeaders" in aArgs) {
       for (let key in aArgs.clobberHeaders) {
         let value = aArgs.clobberHeaders[key];
         if (value === null)
           delete msg.headers[key];
@@ -970,36 +969,35 @@ MessageGenerator.prototype = {
 
     return msg;
   },
 
   /**
    * Create an encrypted SMime message. It's just a wrapper around makeMessage,
    * that sets the right content-type. Use like makeMessage.
    */
-  makeEncryptedSMimeMessage:
-      function MessageGenerate_makeEncryptedSMimeMessage(aOptions) {
+  makeEncryptedSMimeMessage(aOptions) {
     if (!aOptions)
       aOptions = {};
     aOptions.clobberHeaders = {
-      'Content-Transfer-Encoding': 'base64',
-      'Content-Disposition': 'attachment; filename="smime.p7m"',
-    }
+      "Content-Transfer-Encoding": "base64",
+      "Content-Disposition": 'attachment; filename="smime.p7m"',
+    };
     if (!aOptions.body)
       aOptions.body = {};
     aOptions.body.contentType = 'application/pkcs7-mime; name="smime.p7m"';
     let msg = this.makeMessage(aOptions);
     return msg;
   },
 
   MAKE_MESSAGES_DEFAULTS: {
     count: 10,
   },
-  MAKE_MESSAGES_PROPAGATE: ['attachments', 'body', 'cc', 'from', 'inReplyTo',
-                            'subject', 'to', 'clobberHeaders', 'junk', 'read'],
+  MAKE_MESSAGES_PROPAGATE: ["attachments", "body", "cc", "from", "inReplyTo",
+                            "subject", "to", "clobberHeaders", "junk", "read"],
   /**
    * Given a set definition, produce a list of synthetic messages.
    *
    * The set definition supports the following attributes:
    *  count: The number of messages to create.
    *  age: As used by makeMessage.
    *  age_incr: Similar to age, but used to increment the values in the age
    *      dictionary (assuming a value of zero if omitted).
@@ -1010,24 +1008,24 @@ MessageGenerator.prototype = {
    *
    * Also supported are the following attributes as defined by makeMessage:
    *  attachments, body, from, inReplyTo, subject, to, clobberHeaders, junk
    *
    * If omitted, the following defaults are used, but don't depend on this as we
    *  can change these at any time:
    * - count: 10
    */
-  makeMessages: function MessageGenerator_makeMessages(aSetDef) {
+  makeMessages(aSetDef) {
     let messages = [];
 
     let args = {};
     // zero out all the age_incr fields in age (if present)
     if (aSetDef.age_incr) {
       args.age = {};
-      for (let [unit, delta] of Object.entries(aSetDef.age_incr))
+      for (let [unit] of Object.entries(aSetDef.age_incr))
         args.age[unit] = 0;
     }
     // copy over the initial values from age (if present)
     if (aSetDef.age) {
       args.age = args.age || {};
       for (let [unit, value] of Object.entries(aSetDef.age))
         args.age[unit] = value;
     }
@@ -1070,69 +1068,69 @@ MessageGenerator.prototype = {
  *
  * @param aMessageGenerator The optional message generator we should use.
  *     If you don't pass one, we create our own.  You would want to pass one so
  *     that if you also create synthetic messages directly via the message
  *     generator then the two sources can avoid duplicate use of the same
  *     names/addresses/subjects/message-ids.
  */
 function MessageScenarioFactory(aMessageGenerator) {
-  if(!aMessageGenerator)
+  if (!aMessageGenerator)
     aMessageGenerator = new MessageGenerator();
   this._msgGen = aMessageGenerator;
 }
 
 MessageScenarioFactory.prototype = {
   /** Create a chain of direct-reply messages of the given length. */
-  directReply: function(aNumMessages) {
+  directReply(aNumMessages) {
     aNumMessages = aNumMessages || 2;
     let messages = [this._msgGen.makeMessage()];
     for (let i = 1; i < aNumMessages; i++) {
-      messages.push(this._msgGen.makeMessage({inReplyTo: messages[i-1]}));
+      messages.push(this._msgGen.makeMessage({inReplyTo: messages[i - 1]}));
     }
     return messages;
   },
 
   /** Two siblings (present), one parent (missing). */
-  siblingsMissingParent: function() {
+  siblingsMissingParent() {
     let missingParent = this._msgGen.makeMessage();
     let msg1 = this._msgGen.makeMessage({inReplyTo: missingParent});
     let msg2 = this._msgGen.makeMessage({inReplyTo: missingParent});
     return [msg1, msg2];
   },
 
   /** Present parent, missing child, present grand-child. */
-  missingIntermediary: function() {
+  missingIntermediary() {
     let msg1 = this._msgGen.makeMessage();
     let msg2 = this._msgGen.makeMessage({inReplyTo: msg1});
     let msg3 = this._msgGen.makeMessage({inReplyTo: msg2});
     return [msg1, msg3];
   },
 
   /**
    * The root message and all non-leaf nodes have aChildrenPerParent children,
    *  for a total of aHeight layers.  (If aHeight is 1, we have just the root;
    *  if aHeight is 2, the root and his aChildrePerParent children.)
    */
-  fullPyramid: function(aChildrenPerParent, aHeight) {
+  fullPyramid(aChildrenPerParent, aHeight) {
     let msgGen = this._msgGen;
     let root = msgGen.makeMessage();
     let messages = [root];
     function helper(aParent, aRemDepth) {
       for (let iChild = 0; iChild < aChildrenPerParent; iChild++) {
         let child = msgGen.makeMessage({inReplyTo: aParent});
         messages.push(child);
         if (aRemDepth)
           helper(child, aRemDepth - 1);
       }
     }
     if (aHeight > 1)
       helper(root, aHeight - 2);
     return messages;
-  }
+  },
 };
 
 /**
  * Decorate the given object's methods will python-style method binding.  We
  *  create a getter that returns a method that wraps the call, providing the
  *  actual method with the 'this' of the object that was 'this' when the getter
  *  was called.
  * Note that we don't follow the prototype chain; we only process the object you
@@ -1145,16 +1143,16 @@ MessageScenarioFactory.prototype = {
  *     probably be your prototype object.
  */
 function bindMethods(aObj) {
   for (let [name, ubfunc] of Object.entries(aObj)) {
     // the variable binding needs to get captured...
     let realFunc = ubfunc;
     delete aObj[name];
     Object.defineProperty(aObj, name, {
-      get: function getterFunc() {
+      get() {
         return realFunc.bind(this);
-      }
+      },
     });
   }
 }
 
 bindMethods(MessageScenarioFactory.prototype);
--- a/mailnews/test/resources/messageInjection.js
+++ b/mailnews/test/resources/messageInjection.js
@@ -1,14 +1,29 @@
 /* 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/. */
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* import-globals-from asyncTestUtils.js */
+/* import-globals-from logHelper.js */
+/* import-globals-from messageModifier.js */
+
+// This file is included from many different locations. Why the original authors decided they
+// could just dump variables on the global scope and expect them to be there when this file
+// wanted them, I have no idea.
+/* globals createPop3ServerAndLocalFolders, gDEPTH, get_nsIMsgFolder, ims, POP3_PORT, setupServerDaemon */
+
+// ChromeUtils.import should be used for this, but it breaks mozmill.
+// Assume whatever test loaded this file already has mailTestUtils.
+/* globals mailTestUtils */
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
+var {toXPCOMArray} = ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
+
 var imapMessage;
 try {
   var temp = ChromeUtils.import("resource://testing-common/mailnews/imapd.js");
   imapMessage = temp.imapMessage;
 } catch (e) {
   // mozmill tests include this file, but they don't have testing-only modules
   // loaded. In this case, they don't get to use IMAP.
 }
@@ -59,24 +74,22 @@ function configure_message_injection(aIn
     mis.server._logTransactions = false;
 
     mis.rootFolder = mis.incomingServer.rootMsgFolder;
     mis.inboxFolder = mis.rootFolder.getChildNamed("Inbox");
 
     mis.pop3Service = MailServices.pop3;
 
     mis.server.start(POP3_PORT);
-  }
-  else if (mis.injectionConfig.mode == "local") {
+  } else if (mis.injectionConfig.mode == "local") {
     // This does createIncomingServer() and createAccount(), sets the server as
     //  the account's server, then sets the server
     try {
       MailServices.accounts.createLocalMailAccount();
-    }
-    catch (ex) {
+    } catch (ex) {
       // This will fail if someone already called this.  Like in the mozmill
       //  case.
     }
 
     let localAccount = MailServices.accounts.FindAccountForServer(MailServices.accounts.localFoldersServer);
 
     // We need an identity or we get angry warnings.
     let identity = MailServices.accounts.createIdentity();
@@ -94,44 +107,42 @@ function configure_message_injection(aIn
     mis.inboxFolder = mis.rootFolder.getChildNamed("Inbox");
     // a local inbox should have a Mail flag!
     mis.inboxFolder.setFlag(Ci.nsMsgFolderFlags.Mail);
     mis.inboxFolder.setFlag(Ci.nsMsgFolderFlags.Inbox);
     _messageInjectionSetup.notifyListeners("onRealFolderCreated",
                                            [mis.inboxFolder]);
 
     // Force an initialization of the Inbox folder database.
-    let unused = mis.inboxFolder.prettyName;
-  }
-  else if (mis.injectionConfig.mode == "imap") {
+    mis.inboxFolder.prettyName;
+  } else if (mis.injectionConfig.mode == "imap") {
     // Disable autosync in favor of our explicitly forcing downloads of all
     //  messages in a folder.  This is being done speculatively because when we
     //  didn't do this we got tripped up by the semaphore being in use and
     //  concern over inability to hang a listener off of the completion of the
     //  download.  (Although I'm sure there are various ways we could do it.)
     Services.prefs.setBoolPref("mail.server.default.autosync_offline_stores",
                                false);
     // Set the offline property based on the configured setting.  This will
     //  affect newly created folders.
     Services.prefs.setBoolPref("mail.server.default.offline_download",
                                mis.injectionConfig.offline);
 
     // Pull in the IMAP fake server code
     let {
       IMAPPump,
       setupIMAPPump,
-      teardownIMAPPump,
     } = ChromeUtils.import("resource://testing-common/mailnews/IMAPpump.js");
 
     // set up IMAP fakeserver and incoming server
     setupIMAPPump("");
     mis.daemon = IMAPPump.daemon;
     mis.server = IMAPPump.server;
     mis.incomingServer = IMAPPump.incomingServer;
-    //mis.server._debug = 3;
+    // mis.server._debug = 3;
 
     // do not log transactions; it's just a memory leak to us
     mis.server._logTransactions = false;
 
     // We need an identity so that updateFolder doesn't fail
     let localAccount = MailServices.accounts.defaultAccount;
     // We need an email to protect against random code assuming it exists and
     // throwing exceptions.
@@ -157,18 +168,17 @@ function configure_message_injection(aIn
 
     mis.imapService = MailServices.imap;
 
     mis.handleUriToRealFolder = {};
     mis.handleUriToFakeFolder = {};
     mis.realUriToFakeFolder = {};
     mis.realUriToFakeFolder[mis.inboxFolder.URI] =
       mis.daemon.getMailbox("INBOX");
-  }
-  else {
+  } else {
     do_throw("Illegal injection config option: " + mis.injectionConfig.mode);
   }
 
   mis.junkHandle = null;
   mis.junkFolder = null;
 
   mis.trashHandle = null;
   mis.trashFolder = null;
@@ -202,17 +212,17 @@ function _cleanup_message_injection() {
 
 var _messageInjectionSetup = {
   _nextUniqueFolderId: 0,
 
   injectionConfig: {
     mode: "none",
   },
   listeners: [],
-  notifyListeners: function(aHandlerName, aArgs) {
+  notifyListeners(aHandlerName, aArgs) {
     for (let listener of this.listeners) {
       if (aHandlerName in listener)
         listener[aHandlerName].apply(listener, aArgs);
     }
   },
 
   /**
    * The nsIMsgIncomingServer
@@ -302,18 +312,17 @@ function make_empty_folder(aFolderName, 
     testFolder.setFlag(Ci.nsMsgFolderFlags.Mail);
     if (aSpecialFlags) {
       for (let flag of aSpecialFlags) {
         testFolder.setFlag(flag);
       }
     }
     _messageInjectionSetup.notifyListeners("onRealFolderCreated",
                                            [testFolder]);
-  }
-  else if (mis.injectionConfig.mode == "imap") {
+  } else if (mis.injectionConfig.mode == "imap") {
     let promise_completed = async_create_promise();
 
     testFolder = mis.rootFolder.URI + "/" + aFolderName;
 
     // Tell the IMAP service to create the folder, adding a listener that
     //  hooks up the 'handle' URI -> actual folder mapping.
     mis.imapService.createFolder(
       mis.rootFolder,
@@ -340,37 +349,36 @@ function make_empty_folder(aFolderName, 
         mis.handleUriToRealFolder[testFolder] = msgFolder;
         mis.handleUriToFakeFolder[testFolder] = fakeFolder;
         mis.realUriToFakeFolder[msgFolder.URI] = fakeFolder;
 
         // notify listeners
         _messageInjectionSetup.notifyListeners("onRealFolderCreated",
                                                [msgFolder]);
       }, promise_completed));
-   }
-  else if (_messageInjectionSetup.injectionConfig.mode == "pop") {
+  } else if (_messageInjectionSetup.injectionConfig.mode == "pop") {
     throw new Error("You cannot create new folders for POP, I assume.\n");
   }
 
   return testFolder;
 }
 
 // Small helper for moving folder. You have to yield move_folder(f1, f2);
 function move_folder(aSource, aTarget) {
   let array = toXPCOMArray([get_nsIMsgFolder(aSource)], Ci.nsIMutableArray);
   // we're doing a true move
   MailServices.copy.CopyFolders(array, get_nsIMsgFolder(aTarget), true, {
     /* nsIMsgCopyServiceListener implementation */
-    OnStartCopy: function() {},
-    OnProgress: function(aProgress, aProgressMax) {},
-    SetMessageKey: function(aKey) {},
-    SetMessageId: function(aMessageId) {},
-    OnStopCopy: function(aStatus) {
+    OnStartCopy() {},
+    OnProgress(aProgress, aProgressMax) {},
+    SetMessageKey(aKey) {},
+    SetMessageId(aMessageId) {},
+    OnStopCopy(aStatus) {
       async_driver();
-    }
+    },
   }, null);
 
   // Wait for the call above to async_driver to be issued
   return false;
 }
 
 /**
  * Get/create the junk folder handle.  Use get_real_injection_folder if you
@@ -397,18 +405,17 @@ function get_trash_folder() {
     mis.trashFolder = mis.rootFolder.getFolderWithFlags(
                         Ci.nsMsgFolderFlags.Trash);
     if (mis.trashFolder) {
       mis.trashHandle = mis.rootFolder.URI + "/Trash";
       let fakeFolder = mis.daemon.getMailbox("Trash");
       mis.handleUriToRealFolder[mis.trashHandle] = mis.trashFolder;
       mis.handleUriToFakeFolder[mis.trashHandle] = fakeFolder;
       mis.realUriToFakeFolder[mis.trashFolder.URI] = fakeFolder;
-    }
-    else {
+    } else {
       mis.trashHandle = make_empty_folder("Trash", [Ci.nsMsgFolderFlags.Trash]);
     }
   }
 
   return mis.trashHandle;
 }
 
 /**
@@ -449,16 +456,17 @@ function make_virtual_folder(aFolders, a
   }
   // create an ALL case if we didn't add any terms
   if (terms.length == 0) {
     let term = termCreator.createTerm();
     term.matchAll = true;
     terms.push(term);
   }
 
+  let {VirtualFolderHelper} = ChromeUtils.import("resource:///modules/virtualFolderWrapper.js");
   let wrapped = VirtualFolderHelper.createNewVirtualFolder(
     name, mis.rootFolder, aFolders, terms,
     /* online */ false);
   _messageInjectionSetup.notifyListeners("onVirtualFolderCreated",
                                          [wrapped.virtualFolder]);
   return wrapped.virtualFolder;
 }
 
@@ -572,17 +580,17 @@ var make_new_sets_in_folder = make_new_s
 
 /**
  * An iterator that generates an infinite sequence of its argument.  So
  *  _looperator(1, 2, 3) will generate the iteration stream: [1, 2, 3, 1, 2, 3,
  *  1, 2, 3, ...].  For use by add_sets_across_folders.
  */
 function* _looperator(aList) {
   if (aList.length == 0)
-    throw new Exception("aList must have at least one item!");
+    throw new Error("aList must have at least one item!");
 
   let i = 0, length = aList.length;
   while (true) {
     yield aList[i];
     i = (i + 1) % length;
   }
 }
 
@@ -616,76 +624,68 @@ function* _looperator(aList) {
  *     not want this and so will want to pass true for this argument.
  *
  * @return true if we were able to do the injection synchronously (e.g. for
  *     a localstore account), false if we kicked off an asynchronous process
  *     (e.g. for an imap account) and we will call |async_driver| when
  *     we are done.  This is consistent with asyncTestUtils support.
  */
 function add_sets_to_folders(aMsgFolders, aMessageSets, aDoNotForceUpdate) {
-  if ((typeof(aMsgFolders) == "string") || !('length' in aMsgFolders))
+  if ((typeof(aMsgFolders) == "string") || !("length" in aMsgFolders))
     aMsgFolders = [aMsgFolders];
 
   let mis = _messageInjectionSetup;
 
-  let iterFolders, folderList;
-  let popMessages, msgHdrs;
+  let iterFolders;
+  let popMessages;
 
   _messageInjectionSetup.notifyListeners("onInjectingMessages", []);
 
   // -- Pre-loop
   if (mis.injectionConfig.mode == "local") {
     for (let folder of aMsgFolders) {
       if (!(folder instanceof Ci.nsIMsgLocalMailFolder))
-        throw new Exception("All folders in aMsgFolders must be local folders!");
+        throw new Error("All folders in aMsgFolders must be local folders!");
     }
-    folderList = aMsgFolders;
-  }
-  else if (mis.injectionConfig.mode == "imap") {
+  } else if (mis.injectionConfig.mode == "imap") {
     // no protection is possible because of our dependency on promises,
     //  although we could check that the fake URL is one we handed out.
-    folderList = aMsgFolders;
-  }
-  else if (mis.injectionConfig.mode == "pop") {
+  } else if (mis.injectionConfig.mode == "pop") {
     for (let folder of aMsgFolders) {
       if (folder.URI != mis.inboxFolder.URI)
-        throw new Exception("We only support the Inbox for POP injection");
+        throw new Error("We only support the Inbox for POP injection");
     }
-    folderList = aMsgFolders;
 
     // ugh, so this is really a degenerate case where everything we do is
     //  overkill, but let's try this at least.
     popMessages = [];
-  }
-  else {
+  } else {
     do_throw("Message injection is not configured!");
   }
 
   if (mis.injectionConfig.mode == "local") {
     // Note: in order to cut down on excessive fsync()s, we do a two-pass
     //  approach.  In the first pass we just allocate messages to the folder
     //  we are going to insert them into.  In the second pass we insert the
     //  messages into folders in batches and perform any mutations.
-    let folderBatches = aMsgFolders.map(folder =>
-                                        new Object({folder: folder, messages: []}));
+    let folderBatches = aMsgFolders.map(folder => { return {folder, messages: []}; });
     iterFolders = _looperator([...folderBatches.keys()]);
     let iPerSet = 0, folderNext = iterFolders.next();
 
     // - allocate messages to folders
     // loop, incrementing our subscript until all message sets are out of messages
     let didSomething;
     do {
       didSomething = false;
       // for each message set, if it is not out of messages, add the message
       for (let messageSet of aMessageSets) {
         if (iPerSet < messageSet.synMessages.length) {
           let synMsg = messageSet._trackMessageAddition(folderBatches[folderNext.value].folder,
                                                         iPerSet);
-          folderBatches[folderNext.value].messages.push({ messageSet: messageSet, synMsg: synMsg,
-                                    index: iPerSet });
+          folderBatches[folderNext.value].messages.push({ messageSet, synMsg, index: iPerSet });
           didSomething = true;
         }
       }
       iPerSet++;
       folderNext = iterFolders.next();
     } while (didSomething);
 
     // - inject messages
@@ -710,42 +710,39 @@ function add_sets_to_folders(aMsgFolders
         if (synMsgState.read) {
           // XXX this will generate an event; I'm not sure if we should be
           //  trying to avoid that or not.  This case is really only added
           //  for IMAP where this makes more sense.
           message.messageSet.setRead(true,
             message.messageSet.getMsgHdr(message.index));
         }
       }
-      if (folderBatch.messages.length)
-      {
-        let lastMRUTime = Math.floor(Number(folderBatch.messages[0].synMsg.date)
-                                     / 1000);
+      if (folderBatch.messages.length) {
+        let lastMRUTime = Math.floor(Number(folderBatch.messages[0].synMsg.date) / 1000);
         folder.setStringProperty("MRUTime", lastMRUTime);
       }
       folder.gettingNewMessages = false;
       folder.hasNewMessages = true;
       folder.setNumNewMessages(folder.getNumNewMessages(false)
                                + messageStrings.length);
       folder.biffState = Ci.nsIMsgFolder.nsMsgBiffState_NewMail;
     }
 
     // make sure that junk filtering gets a turn
     // XXX we probably need to be doing more in terms of filters here,
     //  although since filters really want to be run on the inbox, there
     //  are separate potential semantic issues involved.
     for (let folder of aMsgFolders) {
       folder.callFilterPlugins(null);
     }
-  }
-  else if (mis.injectionConfig.mode == "imap") {
+  } else if (mis.injectionConfig.mode == "imap") {
     iterFolders = _looperator(aMsgFolders);
     // we need to call updateFolder on all the folders, not just the first
     //  one...
-    return async_run({func: function*() {
+    return async_run({* func() {
       yield wait_for_async_promises();
 
       let iPerSet = 0, folder = iterFolders.next();
       let didSomething;
       do {
         didSomething = false;
         for (let messageSet of aMessageSets) {
           if (iPerSet < messageSet.synMessages.length) {
@@ -788,18 +785,17 @@ function add_sets_to_folders(aMsgFolders
         // compel download of the messages if appropriate
         if (realFolder.flags & Ci.nsMsgFolderFlags.Offline) {
           mark_action("messageInjection", "offlining messages", [realFolder]);
           realFolder.downloadAllForOffline(asyncUrlListener, null);
           yield false;
         }
       }
     }});
-  }
-  else if (mis.injectionConfig.mode == "pop") {
+  } else if (mis.injectionConfig.mode == "pop") {
     iterFolders = _looperator(aMsgFolders);
 
     let iPerSet = 0, folder = iterFolders.next();
     // loop, incrementing our subscript until all message sets are out of messages
     let didSomething;
     do {
       didSomething = false;
       // for each message set, if it is not out of messages, add the message
@@ -817,17 +813,17 @@ function add_sets_to_folders(aMsgFolders
     if (aDoNotForceUpdate)
       return true;
     ims.pop3Service.GetNewMail(null, asyncUrlListener, mis.inboxFolder,
                                mis.incomingServer);
     return false; // wait for the url listener to be notified
   }
 
   return true;
-};
+}
 /** singular function name for understandability of single-folder users */
 var add_sets_to_folder = add_sets_to_folders;
 
 /**
  * Return the nsIMsgFolder associated with a folder handle.  If the folder has
  *  been created since the last injection and you are using IMAP, you may need
  *  to first "yield wait_for_async_promises();" for us to be able to provide
  *  you with a result.
@@ -844,18 +840,17 @@ function get_real_injection_folder(aFold
  * Helper function for any of the convenience functions that integrate
  *  message injection.
  */
 function wait_for_message_injection() {
   let mis = _messageInjectionSetup;
   if (mis.injectionConfig.mode == "imap" ||
       mis.injectionConfig.mode == "pop")
     return false;
-  else
-    return true;
+  return true;
 }
 
 /**
  * Asynchronously move messages in the given set to the destination folder.
  *
  * For IMAP moves we force an update of the source folder and then the
  *  destination folder.  This ensures that any (pseudo-)offline operations in
  *  the source folder have had a chance to run and that we have seen the changes
@@ -867,17 +862,17 @@ function wait_for_message_injection() {
  * @param aDestFolder The target folder.
  * @param [aAllowUndo=false] Should we generate undo operations and, as a
  *     side-effect, offline operations?  (The code uses undo operations as
  *     a proxy-indicator for it coming from the UI and therefore performing
  *     pseudo-offline operations instead of trying to do things online.)
  */
 function async_move_messages(aSynMessageSet, aDestFolder, aAllowUndo) {
   mark_action("messageInjection", "moving messages", aSynMessageSet.msgHdrList);
-  return async_run({func: function*() {
+  return async_run({* func() {
       // we need to make sure all folder promises are fulfilled
       yield wait_for_async_promises();
       // and then we can make sure we have the actual folder
       let realDestFolder = get_real_injection_folder(aDestFolder);
 
       for (let [folder, xpcomHdrArray] of
            aSynMessageSet.foldersWithXpcomHdrArrays()) {
         mark_action("messageInjection",
@@ -933,17 +928,17 @@ function async_move_messages(aSynMessage
  *
  * @param aSynMessageSet The set of messages to trash.  The messages do not all
  *     have to be in the same folder, but we have to trash them folder by
  *     folder if they are not.
  */
 function async_trash_messages(aSynMessageSet) {
   mark_action("messageInjection", "trashing messages",
               aSynMessageSet.msgHdrList);
-  return async_run({func: function*() {
+  return async_run({* func() {
       for (let [folder, xpcomHdrArray] of
            aSynMessageSet.foldersWithXpcomHdrArrays()) {
         mark_action("messageInjection", "trashing messages in folder",
                     [folder]);
         // In the IMAP case tell listeners we are moving messages without
         //  destination headers, since that's what trashing amounts to.
         if (!message_injection_is_local())
           _messageInjectionSetup.notifyListeners(
@@ -1011,17 +1006,17 @@ function async_delete_messages(aSynMessa
   }
   return true;
 }
 
 /**
  * Empty the trash.
  */
 function async_empty_trash() {
-  return async_run({func: function*() {
+  return async_run({* func() {
     let trashHandle = get_trash_folder();
     yield wait_for_async_promises();
     let trashFolder = get_real_injection_folder(trashHandle);
     trashFolder.emptyTrash(null, asyncUrlListener);
     yield false;
   }});
 }
 
--- a/mailnews/test/resources/messageModifier.js
+++ b/mailnews/test/resources/messageModifier.js
@@ -1,11 +1,11 @@
 /* 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/. */
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * This file provides a number of methods for modifying (synthetic) messages
  *  for testing purposes.
  */
 
 var {toXPCOMArray} = ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
@@ -28,17 +28,17 @@ var {MailServices} = ChromeUtils.import(
  *     in.  The value may also be null if the message has not yet been
  *     inserted into a folder.
  */
 function SyntheticMessageSet(aSynMessages, aMsgFolders, aFolderIndices) {
   this.synMessages = aSynMessages;
 
   if (aMsgFolders == null)
     this.msgFolders = [];
-  else if (!('length' in aMsgFolders))
+  else if (!("length" in aMsgFolders))
     this.msgFolders = [aMsgFolders];
   else
     this.msgFolders = aMsgFolders;
 
   if (aFolderIndices == null)
     this.folderIndices = aSynMessages.map(_ => null);
   else
     this.folderIndices = aFolderIndices;
@@ -46,90 +46,89 @@ function SyntheticMessageSet(aSynMessage
 SyntheticMessageSet.prototype = {
   /**
    * Helper method for messageInjection to use to tell us it is injecting a
    *  message in a given folder.  As a convenience, we also return the
    *  synthetic message.
    *
    * @protected
    */
-  _trackMessageAddition: function(aFolder, aMessageIndex) {
+  _trackMessageAddition(aFolder, aMessageIndex) {
     let aFolderIndex = this.msgFolders.indexOf(aFolder);
     if (aFolderIndex == -1)
       aFolderIndex = this.msgFolders.push(aFolder) - 1;
     this.folderIndices[aMessageIndex] = aFolderIndex;
     return this.synMessages[aMessageIndex];
   },
   /**
    * Helper method for use by |async_move_messages| to tell us that it moved
    *  all the messages from aOldFolder to aNewFolder.
    */
-  _folderSwap: function(aOldFolder, aNewFolder) {
+  _folderSwap(aOldFolder, aNewFolder) {
     let folderIndex = this.msgFolders.indexOf(aOldFolder);
     this.msgFolders[folderIndex] = aNewFolder;
   },
 
   /**
    * Union this set with another set and return the (new) result.
    *
    * @param aOtherSet The other synthetic message set.
    * @returns a new SyntheticMessageSet containing the union of this set and
    *     the other set.
    */
-  union: function(aOtherSet) {
+  union(aOtherSet) {
     let messages = this.synMessages.concat(aOtherSet.synMessages);
     let folders = this.msgFolders.concat();
     let indices = this.folderIndices.concat();
 
     let folderUrisToIndices = {};
     for (let [iFolder, folder] of this.msgFolders.entries()) {
       folderUrisToIndices[folder.URI] = iFolder;
     }
 
     for (let iOther = 0; iOther < aOtherSet.synMessages.length; iOther++) {
       let folderIndex = aOtherSet.folderIndices[iOther];
       if (folderIndex == null) {
         indices.push(folderIndex);
-      }
-      else {
+      } else {
         let folder = aOtherSet.msgFolders[folderIndex];
         if (!(folder.URI in folderUrisToIndices)) {
           folderUrisToIndices[folder.URI] = folders.length;
           folders.push(folder);
         }
         indices.push(folderUrisToIndices[folder.URI]);
       }
     }
 
     return new SyntheticMessageSet(messages, folders, indices);
   },
 
   /**
    * Get the single message header of the message at the given index; use
    *  |msgHdrs| or |xpcomHdrArray| if you want to get all the headers at once.
    */
-  getMsgHdr: function(aIndex) {
+  getMsgHdr(aIndex) {
     let folder = this.msgFolders[this.folderIndices[aIndex]];
     let synMsg = this.synMessages[aIndex];
     return folder.msgDatabase.getMsgHdrForMessageID(synMsg.messageId);
   },
 
   /**
    * Get the URI for the message at the given index.
    */
-  getMsgURI: function(aIndex) {
+  getMsgURI(aIndex) {
     let msgHdr = this.getMsgHdr(aIndex);
     return msgHdr.folder.getUriForMsg(msgHdr);
   },
 
   /**
    * @return a JS iterator of the message headers for all messages inserted into
    *     a folder.
    */
-  msgHdrs: function*() {
+  * msgHdrs() {
     // get the databases
     let msgDatabases = this.msgFolders.map(folder => folder.msgDatabase);
     for (let [iMsg, synMsg] of this.synMessages.entries()) {
       let folderIndex = this.folderIndices[iMsg];
       if (folderIndex != null)
         yield msgDatabases[folderIndex].getMsgHdrForMessageID(synMsg.messageId);
     }
   },
@@ -163,82 +162,82 @@ SyntheticMessageSet.prototype = {
       }
     }
     return results;
   },
   /**
    * @return a generator that yields [nsIMsgFolder, nsIMutableArray of the
    *     messages from the set in that folder].
    */
-  foldersWithXpcomHdrArrays: function*() {
+  * foldersWithXpcomHdrArrays() {
     for (let [folder, msgHdrs] of this.foldersWithMsgHdrs) {
       yield [folder, toXPCOMArray(msgHdrs,
                                   Ci.nsIMutableArray)];
     }
   },
   /**
    * Sets the status of the messages to read/unread.
    *
    * @param aRead    true/false to set messages as read/unread
    * @param aMsgHdr  A message header to work on. If not specified,
    *                 mark all messages in the current set.
    */
-  setRead: function(aRead, aMsgHdr) {
+  setRead(aRead, aMsgHdr) {
     let msgHdrs = aMsgHdr ? [aMsgHdr] : this.msgHdrList;
     for (let msgHdr of msgHdrs) {
       msgHdr.markRead(aRead);
     }
   },
-  setStarred: function(aStarred) {
+  setStarred(aStarred) {
     for (let msgHdr of this.msgHdrs()) {
       msgHdr.markFlagged(aStarred);
     }
   },
-  addTag: function(aTagName) {
+  addTag(aTagName) {
     for (let [folder, xpcomHdrArray] of this.foldersWithXpcomHdrArrays()) {
       folder.addKeywordsToMessages(xpcomHdrArray, aTagName);
     }
   },
-  removeTag: function(aTagName) {
+  removeTag(aTagName) {
     for (let [folder, xpcomHdrArray] of this.foldersWithXpcomHdrArrays()) {
       folder.removeKeywordsFromMessages(xpcomHdrArray, aTagName);
     }
   },
   /**
    * Sets the junk score for the messages to junk/non-junk.  It does not
    *  involve the bayesian classifier because we really don't want it
    *  affecting our unit tests!  (Unless we were testing the bayesian
    *  classifier.  Which I'm conveniently not.  Feel free to add a
    *  "setJunkForRealsies" method if you are.)
    *
    * @param aIsJunk  true/false to set messages to junk/non-junk
    * @param aMsgHdr  A message header to work on. If not specified,
    *                 mark all messages in the current set.
    * Generates a JunkStatusChanged nsIMsgFolderListener itemEvent notification.
    */
-  setJunk: function(aIsJunk, aMsgHdr) {
+  setJunk(aIsJunk, aMsgHdr) {
     let junkscore = aIsJunk ? "100" : "0";
     let msgHdrs = aMsgHdr ? [aMsgHdr] : this.msgHdrList;
     for (let msgHdr of msgHdrs) {
       msgHdr.setStringProperty("junkscore", junkscore);
-    };
+    }
 
     let str = aIsJunk ? "junk" : "notjunk";
     let xpcomHdrArray = toXPCOMArray(msgHdrs, Ci.nsIMutableArray);
     MailServices.mfn.notifyItemEvent(xpcomHdrArray,
                                      "JunkStatusChanged",
                                      null, str);
   },
 
   /**
    * Slice the message set using the exact Array.prototype.slice semantics
    * (because we call Array.prototype.slice).
    */
-  slice: function(...aArgs) {
+  slice(...aArgs) {
     let slicedMessages = this.synMessages.slice(...aArgs);
     let slicedIndices = this.folderIndices.slice(...aArgs);
     let sliced = new SyntheticMessageSet(slicedMessages, this.msgFolders,
                                          slicedIndices);
     if (("glodaMessages" in this) && this.glodaMessages)
       sliced.glodaMessages = this.glodaMessages.slice(...aArgs);
     return sliced;
-  }
+  },
 };
--- a/mailnews/test/resources/msgFolderListenerSetup.js
+++ b/mailnews/test/resources/msgFolderListenerSetup.js
@@ -1,279 +1,247 @@
+/* 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/. */
+
+// ChromeUtils.import should be used for this, but it breaks mozmill.
+// Assume whatever test loaded this file already has mailTestUtils.
+/* globals mailTestUtils */
+
 var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var allTestedEvents =
   MailServices.mfn.msgAdded |
   MailServices.mfn.msgsClassified |
   MailServices.mfn.msgsDeleted |
   MailServices.mfn.msgsMoveCopyCompleted |
   MailServices.mfn.msgKeyChanged |
   MailServices.mfn.folderAdded |
   MailServices.mfn.folderDeleted |
   MailServices.mfn.folderMoveCopyCompleted |
   MailServices.mfn.folderRenamed |
   MailServices.mfn.itemEvent;
 
-var gCopyService = MailServices.copy;
-
 // Current test being executed
 var gTest = 1;
 
 // Which events are expected
 var gExpectedEvents = [];
 
 // The current status (what all has been done)
 var gCurrStatus = 0;
-var kStatus =
-{
+var kStatus = {
   notificationsDone: 0x1,
   onStopCopyDone: 0x2,
   functionCallDone: 0x4,
-  everythingDone: 0
+  everythingDone: 0,
 };
 kStatus.everythingDone = kStatus.notificationsDone | kStatus.onStopCopyDone | kStatus.functionCallDone;
 
 // For CopyFileMessage: this stores the header that was received
-var gHdrsReceived = new Array();
+var gHdrsReceived = [];
 
-var gMsgHdrs = new Array();
+var gMsgHdrs = [];
 
 // Our listener, which captures events and verifies them as they are received.
-var gMFListener =
-{
-  msgAdded: function(aMsg)
-  {
+var gMFListener = {
+  msgAdded(aMsg) {
     verify([MailServices.mfn.msgAdded, aMsg]);
     // We might not actually have a header in gHdrsReceived in the IMAP case,
     // so use the aMsg we got instead
     gMsgHdrs.push({hdr: aMsg, ID: aMsg.messageId});
-    if (gExpectedEvents.length == 0)
-    {
+    if (gExpectedEvents.length == 0) {
       gCurrStatus |= kStatus.notificationsDone;
       if (gCurrStatus == kStatus.everythingDone)
         resetStatusAndProceed();
-    }
-    else if (gExpectedEvents[0][0] == MailServices.mfn.msgsClassified)
-    {
+    } else if (gExpectedEvents[0][0] == MailServices.mfn.msgsClassified) {
       // XXX this is a hack to deal with limitations of the classification logic
       //  and the new list.  We want to issue a call to clear the list once all
       //  the messages have been added, which would be when the next expected
       //  event is msgsClassified.  (The limitation is that if we don't do this,
       //  we can end up getting told about this message again later.)
       aMsg.folder.clearNewMessages();
     }
   },
 
-  msgsClassified: function(aMsgs, aJunkProcessed, aTraitProcessed)
-  {
+  msgsClassified(aMsgs, aJunkProcessed, aTraitProcessed) {
     dump("classified id: " + aMsgs.queryElementAt(0, Ci.nsIMsgDBHdr).messageId + "\n");
     verify([MailServices.mfn.msgsClassified, aMsgs, aJunkProcessed,
               aTraitProcessed]);
-    if (gExpectedEvents.length == 0)
-    {
+    if (gExpectedEvents.length == 0) {
       gCurrStatus |= kStatus.notificationsDone;
       if (gCurrStatus == kStatus.everythingDone)
         resetStatusAndProceed();
     }
   },
 
-  msgsDeleted: function(aMsgs)
-  {
+  msgsDeleted(aMsgs) {
     verify([MailServices.mfn.msgsDeleted, aMsgs]);
-    if (gExpectedEvents.length == 0)
-    {
+    if (gExpectedEvents.length == 0) {
       gCurrStatus |= kStatus.notificationsDone;
       if (gCurrStatus == kStatus.everythingDone)
         resetStatusAndProceed();
     }
   },
 
-  msgsMoveCopyCompleted: function(aMove, aSrcMsgs, aDestFolder, aDestMsgs)
-  {
+  msgsMoveCopyCompleted(aMove, aSrcMsgs, aDestFolder, aDestMsgs) {
     verify([MailServices.mfn.msgsMoveCopyCompleted, aMove, aSrcMsgs, aDestFolder,
             aDestMsgs]);
-    if (gExpectedEvents.length == 0)
-    {
+    if (gExpectedEvents.length == 0) {
       gCurrStatus |= kStatus.notificationsDone;
       if (gCurrStatus == kStatus.everythingDone)
         resetStatusAndProceed();
     }
   },
 
-  msgKeyChanged: function(aOldKey, aNewMsgHdr)
-  {
+  msgKeyChanged(aOldKey, aNewMsgHdr) {
     verify([MailServices.mfn.msgKeyChanged, aOldKey, aNewMsgHdr]);
-    if (gExpectedEvents.length == 0)
-    {
+    if (gExpectedEvents.length == 0) {
       gCurrStatus |= kStatus.notificationsDone;
       if (gCurrStatus == kStatus.everythingDone)
         resetStatusAndProceed();
     }
   },
 
-  folderAdded: function(aFolder)
-  {
+  folderAdded(aFolder) {
     verify([MailServices.mfn.folderAdded, aFolder]);
-    if (gExpectedEvents.length == 0)
-    {
+    if (gExpectedEvents.length == 0) {
       gCurrStatus |= kStatus.notificationsDone;
       if (gCurrStatus == kStatus.everythingDone)
         resetStatusAndProceed();
     }
   },
 
-  folderDeleted: function(aFolder)
-  {
+  folderDeleted(aFolder) {
     verify([MailServices.mfn.folderDeleted, aFolder]);
-    if (gExpectedEvents.length == 0)
-    {
+    if (gExpectedEvents.length == 0) {
       gCurrStatus |= kStatus.notificationsDone;
       if (gCurrStatus == kStatus.everythingDone)
         resetStatusAndProceed();
     }
   },
 
-  folderMoveCopyCompleted: function(aMove, aSrcFolder, aDestFolder)
-  {
+  folderMoveCopyCompleted(aMove, aSrcFolder, aDestFolder) {
     verify([MailServices.mfn.folderMoveCopyCompleted, aMove, aSrcFolder, aDestFolder]);
-    if (gExpectedEvents.length == 0)
-    {
+    if (gExpectedEvents.length == 0) {
       gCurrStatus |= kStatus.notificationsDone;
       if (gCurrStatus == kStatus.everythingDone)
         resetStatusAndProceed();
     }
   },
 
-  folderRenamed: function(aOrigFolder, aNewFolder)
-  {
+  folderRenamed(aOrigFolder, aNewFolder) {
     verify([MailServices.mfn.folderRenamed, aOrigFolder, aNewFolder]);
-    if (gExpectedEvents.length == 0)
-    {
+    if (gExpectedEvents.length == 0) {
       gCurrStatus |= kStatus.notificationsDone;
       if (gCurrStatus == kStatus.everythingDone)
         resetStatusAndProceed();
     }
   },
 
-  itemEvent: function(aFolder, aEvent, aBetterBeNull, aBetterBeEmpty)
-  {
+  itemEvent(aFolder, aEvent, aBetterBeNull, aBetterBeEmpty) {
     // we currently require the third argument to be null, and the fourth to be
     // empty...
     Assert.equal(aBetterBeNull, null);
     Assert.equal(aBetterBeEmpty, "");
     verify([MailServices.mfn.itemEvent, aFolder, aEvent]);
-    if (gExpectedEvents.length == 0)
-    {
+    if (gExpectedEvents.length == 0) {
       gCurrStatus |= kStatus.notificationsDone;
       if (gCurrStatus == kStatus.everythingDone)
         resetStatusAndProceed();
     }
-  }
+  },
 };
 
 // Copy listener, for proceeding after each operation.
-var copyListener =
-{
+var copyListener = {
   // For CopyFileMessage: this should be the folder the message is being stored to
   mFolderStoredIn: null,
   mMessageId: "",
-  OnStartCopy: function() {},
-  OnProgress: function(aProgress, aProgressMax) {},
-  SetMessageKey: function(aKey)
-  {
+  OnStartCopy() {},
+  OnProgress(aProgress, aProgressMax) {},
+  SetMessageKey(aKey) {
     gHdrsReceived.push(this.mFolderStoredIn.GetMessageHeader(aKey));
   },
-  GetMessageId: function(aMessageId) {
+  GetMessageId(aMessageId) {
     aMessageId = {value: this.mMessageId};
   },
-  OnStopCopy: function(aStatus)
-  {
+  OnStopCopy(aStatus) {
     // Check: message successfully copied.
     Assert.equal(aStatus, 0);
     gCurrStatus |= kStatus.onStopCopyDone;
     if (gCurrStatus == kStatus.everythingDone)
       resetStatusAndProceed();
-  }
+  },
 };
 
-function resetStatusAndProceed()
-{
+function resetStatusAndProceed() {
   gHdrsReceived.length = 0;
   gCurrStatus = 0;
   // Ugly hack: make sure we don't get stuck in a JS->C++->JS->C++... call stack
   // This can happen with a bunch of synchronous functions grouped together, and
   // can even cause tests to fail because they're still waiting for the listener
   // to return
-  do_timeout(0, function(){doTest(++gTest);});
+  do_timeout(0, () => { this.doTest(++gTest); });
 }
 
 // Checks whether the array returned from a function has exactly these elements.
-function hasExactlyElements(array, elements)
-{
+function hasExactlyElements(array, elements) {
   // If an nsIArray (it could also be a single header or a folder)
-  if (elements instanceof Ci.nsIArray)
-  {
+  if (elements instanceof Ci.nsIArray) {
     var count = elements.length;
 
     // Check: array sizes should be equal.
     Assert.equal(count, array.length);
 
-    for (var i = 0; i < count; i++)
-    {
+    for (var i = 0; i < count; i++) {
       // Check: query element, must be a header or folder and present in the array
       var currElement;
       try {
         currElement = elements.queryElementAt(i, Ci.nsIMsgDBHdr);
-      }
-      catch (e) {}
-      if (!currElement)
-      {
+      } catch (e) {}
+      if (!currElement) {
         try {
           currElement = elements.queryElementAt(i, Ci.nsIMsgFolder);
-        }
-        catch (e) {}
+        } catch (e) {}
       }
       Assert.equal(typeof currElement, "object");
       Assert.notEqual(mailTestUtils.non_strict_index_of(array, currElement), -1);
     }
-  }
-  // If a single header or a folder
-  else if (elements instanceof Ci.nsIMsgDBHdr || elements instanceof Ci.nsIMsgFolder)
-  {
+  } else if (elements instanceof Ci.nsIMsgDBHdr || elements instanceof Ci.nsIMsgFolder) {
+    // If a single header or a folder
+
     // Check: there should be only one element in the array.
     Assert.equal(array.length, 1);
 
     // Check: the element should be present
     Assert.notEqual(mailTestUtils.non_strict_index_of(array, elements), -1);
+  } else {
+    // This shouldn't happen
+    do_throw("Unrecognized item returned from listener");
   }
-  // This shouldn't happen
-  else
-    do_throw("Unrecognized item returned from listener");
-};
+}
 
 // Verifies an event
-function verify(event)
-{
+function verify(event) {
   // Check: make sure we actually have an item to process
   Assert.ok(gExpectedEvents.length >= 1);
   var expected = gExpectedEvents.shift();
 
   // Check: events match.
   var eventType = expected[0];
   Assert.equal(event[0], eventType);
 
   dump("..... Verifying event type " + eventType + "\n");
 
-  switch (eventType)
-  {
+  switch (eventType) {
   case MailServices.mfn.msgAdded:
     // So for IMAP right now, we aren't able to get the actual nsIMsgDBHdr.
     // Instead, we'll match up message ids as a (poor?) substitute.
-    if (expected[1].expectedMessageId)
-    {
+    if (expected[1].expectedMessageId) {
       Assert.equal(expected[1].expectedMessageId, event[1].messageId);
       break;
     }
     // If we do have a header, fall through to the case below
   case MailServices.mfn.msgsDeleted:
   case MailServices.mfn.folderDeleted:
     // Check: headers match/folder matches.
     hasExactlyElements(expected[1], event[1]);
@@ -291,18 +259,17 @@ function verify(event)
       if (event[1].length < expected[1].length)
         do_throw("Not enough reported classified messages.");
       let ignoreCount = event[1].length - expected[1].length;
       for (let i = 0; i < expected[1].length; i++) {
         let eventHeader = event[1].queryElementAt(i + ignoreCount,
                                                   Ci.nsIMsgDBHdr);
         Assert.equal(expected[1][i], eventHeader.messageId);
       }
-    }
-    else { // actual headers
+    } else { // actual headers
       hasExactlyElements(expected[1], event[1]);
     }
     // aJunkProcessed: was the message processed for junk?
     Assert.equal(expected[2], event[2]);
     // aTraitProcessed: was the message processed for traits?
     Assert.equal(expected[3], event[3]);
     break;
   case MailServices.mfn.msgKeyChanged:
@@ -321,18 +288,17 @@ function verify(event)
 
     if (eventType == MailServices.mfn.folderMoveCopyCompleted)
       break;
 
     // Check: destination headers.  We expect these for local and imap folders,
     //  but we will not have heard about the headers ahead of time,
     //  so the best we can do is make sure they match up.  To this end,
     //  we check that the message-id header values match up.
-    for (let iMsg = 0; iMsg < event[2].length; iMsg++)
-    {
+    for (let iMsg = 0; iMsg < event[2].length; iMsg++) {
       let srcHdr = event[2].queryElementAt(iMsg, Ci.nsIMsgDBHdr);
       let destHdr = event[4].queryElementAt(iMsg, Ci.nsIMsgDBHdr);
       Assert.equal(srcHdr.messageId, destHdr.messageId);
     }
     break;
   case MailServices.mfn.folderAdded:
     // Check: parent folder matches
     Assert.equal(expected[1].URI, event[1].parent.URI);
--- a/mailnews/test/resources/passwordStorage.js
+++ b/mailnews/test/resources/passwordStorage.js
@@ -1,8 +1,14 @@
+/* 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 gDEPTH */
+
 if (typeof gDEPTH == "undefined")
   do_throw("gDEPTH must be defined when using passwordStorage.js");
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /**
  * Use the given storage database as the current signon database.
  * @returns Promise When the storage database is usable.
--- a/mailnews/test/resources/searchTestUtils.js
+++ b/mailnews/test/resources/searchTestUtils.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/. */
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
- // Contains various functions commonly used in testing mailnews search
+// Contains various functions commonly used in testing mailnews search
 
 /**
  * TestSearch: Class to test number of search hits
  *
  * @param aFolder:   the folder to search
  * @param aValue:    value used for the search
  *                   The interpretation of aValue depends on aAttrib. It
  *                   defaults to string, but for certain attributes other
@@ -20,30 +20,27 @@
  * @param onDone:    function to call on completion of search
  * @param aCustomId: id string for the custom action, if aAttrib is Custom
  * @param aArbitraryHeader  for OtherHeader case, header.
  * @param aHdrProperty      for HdrProperty and Uint32HdrProperty case
  *
  */
 
 function TestSearch(aFolder, aValue, aAttrib, aOp, aHitCount, onDone, aCustomId,
-                    aArbitraryHeader, aHdrProperty)
-{
-  var searchListener =
-  {
-    onSearchHit: function(dbHdr, folder) { hitCount++; },
-    onSearchDone: function(status)
-    {
+                    aArbitraryHeader, aHdrProperty) {
+  var searchListener = {
+    onSearchHit(dbHdr, folder) { hitCount++; },
+    onSearchDone(status) {
       print("Finished search does " + aHitCount + " equal " + hitCount + "?");
       searchSession = null;
       Assert.equal(aHitCount, hitCount);
       if (onDone)
         onDone();
     },
-    onNewSearch: function() {hitCount = 0;}
+    onNewSearch() { hitCount = 0; },
   };
 
   // define and initiate the search session
 
   var hitCount;
   var searchSession = Cc["@mozilla.org/messenger/searchSession;1"]
                         .createInstance(Ci.nsIMsgSearchSession);
   searchSession.addScopeTerm(Ci.nsMsgSearchScope.offlineMail, aFolder);
@@ -98,27 +95,23 @@ function TestSearch(aFolder, aValue, aAt
 /*
  * Test search validity table Available and Enabled settings
  *
  * @param aScope:  search scope (Ci.nsMsgSearchScope.offlineMail, etc.)
  * @param aOp:     search operation (Ci.nsMsgSearchOp.Contains, etc.)
  * @param aAttrib: search attribute (Ci.nsMsgSearchAttrib.Size, etc.)
  * @param aValue:  expected value (true/false) for Available and Enabled
  */
- const gValidityManager = Cc['@mozilla.org/mail/search/validityManager;1']
-                          .getService(Ci.nsIMsgSearchValidityManager);
+ const gValidityManager = Cc["@mozilla.org/mail/search/validityManager;1"]
+                            .getService(Ci.nsIMsgSearchValidityManager);
 
-function testValidityTable(aScope, aOp, aAttrib, aValue)
-{
+function testValidityTable(aScope, aOp, aAttrib, aValue) {
   var validityTable = gValidityManager.getTable(aScope);
   var isAvailable = validityTable.getAvailable(aAttrib, aOp);
   var isEnabled = validityTable.getEnabled(aAttrib, aOp);
-  if (aValue)
-  {
+  if (aValue) {
     Assert.ok(isAvailable);
     Assert.ok(isEnabled);
-  }
-  else
-  {
+  } else {
     Assert.ok(!isAvailable);
     Assert.ok(!isEnabled);
   }
 }