Bug 1609760 - Stop assigning properties to the global `this` in mailnewx/ JSMs (port bug 1608278). r=pmorris DONTBUILD
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Tue, 05 May 2020 11:56:01 +0300
changeset 39058 d2d158a8c71e45f3da486e2252886a489f0f85d5
parent 39057 029fd20ab19e7ff00f6883632e8c2ac909cbaef2
child 39059 7eb659891d336a1dfbf088bf48803a644be120f1
push id402
push userclokep@gmail.com
push dateMon, 29 Jun 2020 20:48:04 +0000
reviewerspmorris
bugs1609760, 1608278
Bug 1609760 - Stop assigning properties to the global `this` in mailnewx/ JSMs (port bug 1608278). r=pmorris DONTBUILD cp ../.gitignore .rgignore && rg -l -g '*.jsm' '' mailnews | jscodeshift --stdin --transform ~/Code/jsm-rewrites/no-this-property-assign.js (Script from https://github.com/bgrins/jsm-rewrites/blob/d2bbd6c459294b65955442e45b5a7f5dba11e639/no-this-property-assign.js)
mailnews/addrbook/jsaddrbook/AddrBookCard.jsm
mailnews/addrbook/jsaddrbook/AddrBookDirectory.jsm
mailnews/addrbook/jsaddrbook/AddrBookMailingList.jsm
mailnews/addrbook/jsaddrbook/AddrBookUtils.jsm
mailnews/base/src/VirtualFolderWrapper.jsm
mailnews/base/util/ABQueryUtils.jsm
mailnews/base/util/ErrUtils.jsm
mailnews/base/util/IOUtils.jsm
mailnews/base/util/JsTreeSelection.jsm
mailnews/base/util/MailnewsMigrator.jsm
mailnews/base/util/MsgDBCacheManager.jsm
mailnews/base/util/TraceHelper.jsm
mailnews/base/util/folderUtils.jsm
mailnews/base/util/hostnameUtils.jsm
mailnews/base/util/iteratorUtils.jsm
mailnews/db/gloda/modules/Collection.jsm
mailnews/db/gloda/modules/Everybody.jsm
mailnews/db/gloda/modules/Gloda.jsm
mailnews/db/gloda/modules/GlodaContent.jsm
mailnews/db/gloda/modules/GlodaDataModel.jsm
mailnews/db/gloda/modules/GlodaDatabind.jsm
mailnews/db/gloda/modules/GlodaDatastore.jsm
mailnews/db/gloda/modules/GlodaExplicitAttr.jsm
mailnews/db/gloda/modules/GlodaFundAttr.jsm
mailnews/db/gloda/modules/GlodaIndexer.jsm
mailnews/db/gloda/modules/GlodaMsgIndexer.jsm
mailnews/db/gloda/modules/GlodaMsgSearcher.jsm
mailnews/db/gloda/modules/GlodaPublic.jsm
mailnews/db/gloda/modules/GlodaQueryClassFactory.jsm
mailnews/db/gloda/modules/GlodaSyntheticView.jsm
mailnews/db/gloda/modules/GlodaUtils.jsm
mailnews/db/gloda/modules/IndexMsg.jsm
mailnews/db/gloda/modules/Log4moz.jsm
mailnews/db/gloda/modules/MimeMessage.jsm
mailnews/db/gloda/modules/NounFreetag.jsm
mailnews/db/gloda/modules/NounMimetype.jsm
mailnews/db/gloda/modules/NounTag.jsm
mailnews/db/gloda/modules/SuffixTree.jsm
mailnews/extensions/newsblog/content/FeedUtils.jsm
mailnews/test/resources/LocalAccountUtils.jsm
mailnews/test/resources/MailTestUtils.jsm
mailnews/test/resources/MessageGenerator.jsm
mailnews/test/resources/MockFactory.jsm
mailnews/test/resources/NetworkTestUtils.jsm
mailnews/test/resources/PromiseTestUtils.jsm
--- a/mailnews/addrbook/jsaddrbook/AddrBookCard.jsm
+++ b/mailnews/addrbook/jsaddrbook/AddrBookCard.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["AddrBookCard"];
+const EXPORTED_SYMBOLS = ["AddrBookCard"];
 
 ChromeUtils.defineModuleGetter(
   this,
   "MailServices",
   "resource:///modules/MailServices.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
--- a/mailnews/addrbook/jsaddrbook/AddrBookDirectory.jsm
+++ b/mailnews/addrbook/jsaddrbook/AddrBookDirectory.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["AddrBookDirectory", "closeConnectionTo"];
+const EXPORTED_SYMBOLS = ["AddrBookDirectory", "closeConnectionTo"];
 
 ChromeUtils.defineModuleGetter(
   this,
   "FileUtils",
   "resource://gre/modules/FileUtils.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
--- a/mailnews/addrbook/jsaddrbook/AddrBookMailingList.jsm
+++ b/mailnews/addrbook/jsaddrbook/AddrBookMailingList.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["AddrBookMailingList"];
+const EXPORTED_SYMBOLS = ["AddrBookMailingList"];
 
 ChromeUtils.defineModuleGetter(
   this,
   "fixIterator",
   "resource:///modules/iteratorUtils.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
--- a/mailnews/addrbook/jsaddrbook/AddrBookUtils.jsm
+++ b/mailnews/addrbook/jsaddrbook/AddrBookUtils.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "exportDirectoryToDelimitedText",
   "exportDirectoryToLDIF",
   "exportDirectoryToVCard",
   "newUID",
   "SimpleEnumerator",
 ];
 
 const { AppConstants } = ChromeUtils.import(
--- a/mailnews/base/src/VirtualFolderWrapper.jsm
+++ b/mailnews/base/src/VirtualFolderWrapper.jsm
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * Wrap everything about virtual folders.
  */
 
-this.EXPORTED_SYMBOLS = ["VirtualFolderHelper"];
+const EXPORTED_SYMBOLS = ["VirtualFolderHelper"];
 
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
 var { fixIterator } = ChromeUtils.import(
   "resource:///modules/iteratorUtils.jsm"
 );
--- a/mailnews/base/util/ABQueryUtils.jsm
+++ b/mailnews/base/util/ABQueryUtils.jsm
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * This file contains helper methods for dealing with addressbook search URIs.
  */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "getSearchTokens",
   "getModelQuery",
   "modelQueryHasUserValue",
   "generateQueryURI",
   "encodeABTermValue",
 ];
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
--- a/mailnews/base/util/ErrUtils.jsm
+++ b/mailnews/base/util/ErrUtils.jsm
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * This file contains helper methods for debugging -- things like logging
  * exception objects, dumping DOM nodes, Events, and generic object dumps.
  */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "logObject",
   "logException",
   "logElement",
   "logEvent",
   "errorWithDebug",
 ];
 
 /**
--- a/mailnews/base/util/IOUtils.jsm
+++ b/mailnews/base/util/IOUtils.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["IOUtils"];
+const EXPORTED_SYMBOLS = ["IOUtils"];
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var kStringBlockSize = 4096;
 var kStreamBlockSize = 8192;
 
 var IOUtils = {
   /**
--- a/mailnews/base/util/JsTreeSelection.jsm
+++ b/mailnews/base/util/JsTreeSelection.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["JSTreeSelection"];
+const EXPORTED_SYMBOLS = ["JSTreeSelection"];
 
 /**
  * Partial nsITreeSelection implementation so that we can have nsMsgDBViews that
  *  exist only for message display but do not need to be backed by a full
  *  tree view widget.  This could also hopefully be used for more xpcshell unit
  *  testing of the FolderDisplayWidget.  It might also be useful for creating
  *  transient selections when right-click selection happens.
  *
--- a/mailnews/base/util/MailnewsMigrator.jsm
+++ b/mailnews/base/util/MailnewsMigrator.jsm
@@ -5,17 +5,17 @@
 /**
  * Migrate profile (prefs and other files) from older versions of Mailnews to
  * current.
  * This should be run at startup. It migrates as needed: each migration
  * function should be written to be a no-op when the value is already migrated
  * or was never used in the old version.
  */
 
-this.EXPORTED_SYMBOLS = ["migrateMailnews"];
+const EXPORTED_SYMBOLS = ["migrateMailnews"];
 
 var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var kServerPrefVersion = 1;
 var kSmtpPrefVersion = 1;
--- a/mailnews/base/util/MsgDBCacheManager.jsm
+++ b/mailnews/base/util/MsgDBCacheManager.jsm
@@ -3,17 +3,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * Message DB Cache manager
  */
 
 /* :::::::: Constants and Helpers ::::::::::::::: */
 
-this.EXPORTED_SYMBOLS = ["msgDBCacheManager"];
+const EXPORTED_SYMBOLS = ["msgDBCacheManager"];
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 var log = Log4Moz.getConfiguredLogger("mailnews.database.dbcache");
 
--- a/mailnews/base/util/TraceHelper.jsm
+++ b/mailnews/base/util/TraceHelper.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["DebugTraceHelper"];
+const EXPORTED_SYMBOLS = ["DebugTraceHelper"];
 
 var SPACES = "                                                   ";
 var BRIGHT_COLORS = {
   red: "\x1b[1;31m",
   green: "\x1b[1;32m",
   yellow: "\x1b[1;33m",
   blue: "\x1b[1;34m",
   magenta: "\x1b[1;35m",
--- a/mailnews/base/util/folderUtils.jsm
+++ b/mailnews/base/util/folderUtils.jsm
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * This file contains helper methods for dealing with nsIMsgFolders.
  */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "getFolderProperties",
   "getSpecialFolderString",
   "allAccountsSorted",
   "getMostRecentFolders",
   "folderNameCompare",
 ];
 
 const { MailServices } = ChromeUtils.import(
--- a/mailnews/base/util/hostnameUtils.jsm
+++ b/mailnews/base/util/hostnameUtils.jsm
@@ -2,17 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * Generic shared utility code for checking of IP and hostname validity.
  */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "isLegalHostNameOrIP",
   "isLegalHostName",
   "isLegalIPv4Address",
   "isLegalIPv6Address",
   "isLegalIPAddress",
   "isLegalLocalIPAddress",
   "cleanUpHostName",
   "kMinPort",
--- a/mailnews/base/util/iteratorUtils.jsm
+++ b/mailnews/base/util/iteratorUtils.jsm
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * This file contains helper methods for dealing with XPCOM iterators (arrays
  * and enumerators) in JS-friendly ways.
  */
 
-this.EXPORTED_SYMBOLS = ["fixIterator", "toXPCOMArray", "toArray"];
+const EXPORTED_SYMBOLS = ["fixIterator", "toXPCOMArray", "toArray"];
 
 var JS_HAS_SYMBOLS = typeof Symbol === "function";
 var ITERATOR_SYMBOL = JS_HAS_SYMBOLS ? Symbol.iterator : "@@iterator";
 
 /**
  * This function will take a number of objects and convert them to an array.
  *
  * Currently, we support the following objects:
--- a/mailnews/db/gloda/modules/Collection.jsm
+++ b/mailnews/db/gloda/modules/Collection.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["GlodaCollection", "GlodaCollectionManager"];
+const EXPORTED_SYMBOLS = ["GlodaCollection", "GlodaCollectionManager"];
 
 const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 
 var LOG = Log4Moz.repository.getLogger("gloda.collection");
 
 /**
  * @namespace Central registry and logic for all collections.
  *
--- a/mailnews/db/gloda/modules/Everybody.jsm
+++ b/mailnews/db/gloda/modules/Everybody.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = [];
+const EXPORTED_SYMBOLS = [];
 
 const { GlodaFundAttr } = ChromeUtils.import(
   "resource:///modules/gloda/GlodaFundAttr.jsm"
 );
 GlodaFundAttr.init();
 const { GlodaExplicitAttr } = ChromeUtils.import(
   "resource:///modules/gloda/GlodaExplicitAttr.jsm"
 );
--- a/mailnews/db/gloda/modules/Gloda.jsm
+++ b/mailnews/db/gloda/modules/Gloda.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["Gloda"];
+const EXPORTED_SYMBOLS = ["Gloda"];
 
 const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 
 const { GlodaDatastore } = ChromeUtils.import(
   "resource:///modules/gloda/GlodaDatastore.jsm"
 );
 const {
   GlodaAttributeDBDef,
--- a/mailnews/db/gloda/modules/GlodaContent.jsm
+++ b/mailnews/db/gloda/modules/GlodaContent.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "GlodaContent",
   "whittlerRegistry",
   "mimeMsgToContentAndMeta",
   "mimeMsgToContentSnippetAndMeta",
 ];
 
 /**
  * Given a MimeMsg and the corresponding folder, return the GlodaContent object.
@@ -75,17 +75,17 @@ WhittlerRegistry.prototype = {
    */
   getWhittlers() {
     // Use the concat() trick to avoid mutating the internal object and
     // leaking an internal representation.
     return this._whittlers.concat().reverse();
   },
 };
 
-this.whittlerRegistry = new WhittlerRegistry();
+const whittlerRegistry = new WhittlerRegistry();
 
 function GlodaContent() {
   this._contentPriority = null;
   this._producing = false;
   this._hunks = [];
 }
 
 GlodaContent.prototype = {
--- a/mailnews/db/gloda/modules/GlodaDataModel.jsm
+++ b/mailnews/db/gloda/modules/GlodaDataModel.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "GlodaAttributeDBDef",
   "GlodaAccount",
   "GlodaConversation",
   "GlodaFolder",
   "GlodaMessage",
   "GlodaContact",
   "GlodaIdentity",
   "GlodaAttachment",
--- a/mailnews/db/gloda/modules/GlodaDatabind.jsm
+++ b/mailnews/db/gloda/modules/GlodaDatabind.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["GlodaDatabind"];
+const EXPORTED_SYMBOLS = ["GlodaDatabind"];
 
 const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 
 function GlodaDatabind(aNounDef, aDatastore) {
   this._nounDef = aNounDef;
   this._tableName = aNounDef.tableName;
   this._tableDef = aNounDef.schema;
   this._datastore = aDatastore;
--- a/mailnews/db/gloda/modules/GlodaDatastore.jsm
+++ b/mailnews/db/gloda/modules/GlodaDatastore.jsm
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* This file looks to Myk Melez <myk@mozilla.org>'s Mozilla Labs snowl
  * project's (https://hg.mozilla.org/labs/snowl/) modules/GlodaDatastore.jsm
  * for inspiration and idioms (and also a name :).
  */
 
-this.EXPORTED_SYMBOLS = ["GlodaDatastore"];
+const EXPORTED_SYMBOLS = ["GlodaDatastore"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { IOUtils } = ChromeUtils.import("resource:///modules/IOUtils.jsm");
 
 const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 
 const {
   GlodaAttributeDBDef,
--- a/mailnews/db/gloda/modules/GlodaExplicitAttr.jsm
+++ b/mailnews/db/gloda/modules/GlodaExplicitAttr.jsm
@@ -4,17 +4,17 @@
 
 /*
  * This file provides the "explicit attribute" provider for messages.  It is
  *  concerned with attributes that are the result of user actions.  For example,
  *  whether a message is starred (flagged), message tags, whether it is
  *  read/unread, etc.
  */
 
-this.EXPORTED_SYMBOLS = ["GlodaExplicitAttr"];
+const EXPORTED_SYMBOLS = ["GlodaExplicitAttr"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 const { Gloda } = ChromeUtils.import("resource:///modules/gloda/Gloda.jsm");
 const { TagNoun } = ChromeUtils.import("resource:///modules/gloda/NounTag.jsm");
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
--- a/mailnews/db/gloda/modules/GlodaFundAttr.jsm
+++ b/mailnews/db/gloda/modules/GlodaFundAttr.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["GlodaFundAttr"];
+const EXPORTED_SYMBOLS = ["GlodaFundAttr"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 const { GlodaUtils } = ChromeUtils.import(
   "resource:///modules/gloda/GlodaUtils.jsm"
 );
 const { Gloda } = ChromeUtils.import("resource:///modules/gloda/Gloda.jsm");
 const { GlodaAttachment } = ChromeUtils.import(
--- a/mailnews/db/gloda/modules/GlodaIndexer.jsm
+++ b/mailnews/db/gloda/modules/GlodaIndexer.jsm
@@ -5,17 +5,17 @@
 /*
  * This file currently contains a fairly general implementation of asynchronous
  *  indexing with a very explicit message indexing implementation.  As gloda
  *  will eventually want to index more than just messages, the message-specific
  *  things should ideally lose their special hold on this file.  This will
  *  benefit readability/size as well.
  */
 
-this.EXPORTED_SYMBOLS = ["GlodaIndexer", "IndexingJob"];
+const EXPORTED_SYMBOLS = ["GlodaIndexer", "IndexingJob"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 const { GlodaDatastore } = ChromeUtils.import(
   "resource:///modules/gloda/GlodaDatastore.jsm"
 );
 const { Gloda } = ChromeUtils.import("resource:///modules/gloda/Gloda.jsm");
 const { GlodaCollectionManager } = ChromeUtils.import(
--- a/mailnews/db/gloda/modules/GlodaMsgIndexer.jsm
+++ b/mailnews/db/gloda/modules/GlodaMsgIndexer.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["GlodaABIndexer", "GlodaABAttrs"];
+const EXPORTED_SYMBOLS = ["GlodaABIndexer", "GlodaABAttrs"];
 
 const { GlodaCollectionManager } = ChromeUtils.import(
   "resource:///modules/gloda/Collection.jsm"
 );
 const { Gloda } = ChromeUtils.import("resource:///modules/gloda/Gloda.jsm");
 const { GlodaIndexer, IndexingJob } = ChromeUtils.import(
   "resource:///modules/gloda/GlodaIndexer.jsm"
 );
--- a/mailnews/db/gloda/modules/GlodaMsgSearcher.jsm
+++ b/mailnews/db/gloda/modules/GlodaMsgSearcher.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["GlodaMsgSearcher"];
+const EXPORTED_SYMBOLS = ["GlodaMsgSearcher"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { Gloda } = ChromeUtils.import(
   "resource:///modules/gloda/GlodaPublic.jsm"
 );
 
 /**
  * How much time boost should a 'score point' amount to?  The authoritative,
--- a/mailnews/db/gloda/modules/GlodaPublic.jsm
+++ b/mailnews/db/gloda/modules/GlodaPublic.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["Gloda"];
+const EXPORTED_SYMBOLS = ["Gloda"];
 
 const { Gloda } = ChromeUtils.import("resource:///modules/gloda/Gloda.jsm");
 /* nothing to import, just run some code */ ChromeUtils.import(
   "resource:///modules/gloda/Everybody.jsm"
 );
 const { GlodaIndexer } = ChromeUtils.import(
   "resource:///modules/gloda/GlodaIndexer.jsm"
 );
--- a/mailnews/db/gloda/modules/GlodaQueryClassFactory.jsm
+++ b/mailnews/db/gloda/modules/GlodaQueryClassFactory.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["GlodaQueryClassFactory"];
+const EXPORTED_SYMBOLS = ["GlodaQueryClassFactory"];
 
 // GlodaDatastore has some constants we need, and oddly enough, there was no
 //  load dependency preventing us from doing this.
 const { GlodaDatastore } = ChromeUtils.import(
   "resource:///modules/gloda/GlodaDatastore.jsm"
 );
 
 /**
--- a/mailnews/db/gloda/modules/GlodaSyntheticView.jsm
+++ b/mailnews/db/gloda/modules/GlodaSyntheticView.jsm
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * This file is charged with providing you a way to have a pretty gloda-backed
  *  nsIMsgDBView.
  */
 
-this.EXPORTED_SYMBOLS = ["GlodaSyntheticView"];
+const EXPORTED_SYMBOLS = ["GlodaSyntheticView"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /**
  * Create a synthetic view suitable for passing to |FolderDisplayWidget.show|.
  * You must pass a query, collection, or conversation in.
  *
  * @param {GlodaQuery} [aArgs.query] A gloda query to run.
--- a/mailnews/db/gloda/modules/GlodaUtils.jsm
+++ b/mailnews/db/gloda/modules/GlodaUtils.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["GlodaUtils"];
+const EXPORTED_SYMBOLS = ["GlodaUtils"];
 
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 /**
  * @namespace A holding place for logic that is not gloda-specific and should
  *  reside elsewhere.
--- a/mailnews/db/gloda/modules/IndexMsg.jsm
+++ b/mailnews/db/gloda/modules/IndexMsg.jsm
@@ -7,17 +7,17 @@
 /*
  * This file currently contains a fairly general implementation of asynchronous
  *  indexing with a very explicit message indexing implementation.  As gloda
  *  will eventually want to index more than just messages, the message-specific
  *  things should ideally lose their special hold on this file.  This will
  *  benefit readability/size as well.
  */
 
-this.EXPORTED_SYMBOLS = ["GlodaMsgIndexer"];
+const EXPORTED_SYMBOLS = ["GlodaMsgIndexer"];
 
 const { fixIterator } = ChromeUtils.import(
   "resource:///modules/iteratorUtils.jsm"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 const { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
--- a/mailnews/db/gloda/modules/Log4moz.jsm
+++ b/mailnews/db/gloda/modules/Log4moz.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["Log4Moz"];
+const EXPORTED_SYMBOLS = ["Log4Moz"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var MODE_WRONLY = 0x02;
 var MODE_CREATE = 0x08;
 var MODE_APPEND = 0x10;
 
 var PERMS_FILE = parseInt("0644", 8);
--- a/mailnews/db/gloda/modules/MimeMessage.jsm
+++ b/mailnews/db/gloda/modules/MimeMessage.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "MsgHdrToMimeMessage",
   "MimeMessage",
   "MimeContainer",
   "MimeBody",
   "MimeUnknown",
   "MimeMessageAttachment",
 ];
 
--- a/mailnews/db/gloda/modules/NounFreetag.jsm
+++ b/mailnews/db/gloda/modules/NounFreetag.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["FreeTag", "FreeTagNoun"];
+const EXPORTED_SYMBOLS = ["FreeTag", "FreeTagNoun"];
 
 const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 
 const { Gloda } = ChromeUtils.import("resource:///modules/gloda/Gloda.jsm");
 
 function FreeTag(aTagName) {
   this.name = aTagName;
 }
--- a/mailnews/db/gloda/modules/NounMimetype.jsm
+++ b/mailnews/db/gloda/modules/NounMimetype.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["MimeType", "MimeTypeNoun"];
+const EXPORTED_SYMBOLS = ["MimeType", "MimeTypeNoun"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 var LOG = Log4Moz.repository.getLogger("gloda.noun.mimetype");
 
 const { Gloda } = ChromeUtils.import("resource:///modules/gloda/Gloda.jsm");
 
 var CategoryStringMap = {};
--- a/mailnews/db/gloda/modules/NounTag.jsm
+++ b/mailnews/db/gloda/modules/NounTag.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["TagNoun"];
+const EXPORTED_SYMBOLS = ["TagNoun"];
 
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 const { Gloda } = ChromeUtils.import("resource:///modules/gloda/Gloda.jsm");
 
 /**
--- a/mailnews/db/gloda/modules/SuffixTree.jsm
+++ b/mailnews/db/gloda/modules/SuffixTree.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["SuffixTree", "MultiSuffixTree"];
+const EXPORTED_SYMBOLS = ["SuffixTree", "MultiSuffixTree"];
 
 /**
  * Given a list of strings and a corresponding map of items that those strings
  *  correspond to, build a suffix tree.
  */
 function MultiSuffixTree(aStrings, aItems) {
   if (aStrings.length != aItems.length) {
     throw new Error("Array lengths need to be the same.");
--- a/mailnews/extensions/newsblog/content/FeedUtils.jsm
+++ b/mailnews/extensions/newsblog/content/FeedUtils.jsm
@@ -1,14 +1,14 @@
 /* -*- Mode: JavaScript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-this.EXPORTED_SYMBOLS = ["Feed", "FeedItem", "FeedParser", "FeedUtils"];
+const EXPORTED_SYMBOLS = ["Feed", "FeedItem", "FeedParser", "FeedUtils"];
 
 /* eslint-disable-next-line no-unused-vars */
 const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 const { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
 const { jsmime } = ChromeUtils.import("resource:///modules/jsmime.jsm");
--- a/mailnews/test/resources/LocalAccountUtils.jsm
+++ b/mailnews/test/resources/LocalAccountUtils.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["localAccountUtils"];
+const EXPORTED_SYMBOLS = ["localAccountUtils"];
 
 // MailServices
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 // Local Mail Folders. Requires prior setup of profile directory
--- a/mailnews/test/resources/MailTestUtils.jsm
+++ b/mailnews/test/resources/MailTestUtils.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["mailTestUtils"];
+const 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"
 );
 
 // See Bug 903946
--- a/mailnews/test/resources/MessageGenerator.jsm
+++ b/mailnews/test/resources/MessageGenerator.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "MessageGenerator",
   "addMessagesToFolder",
   "MessageScenarioFactory",
   "SyntheticPartLeaf",
   "SyntheticDegeneratePartEmpty",
   "SyntheticPartMulti",
   "SyntheticPartMultiMixed",
   "SyntheticPartMultiParallel",
--- a/mailnews/test/resources/MockFactory.jsm
+++ b/mailnews/test/resources/MockFactory.jsm
@@ -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/. */
 
-this.EXPORTED_SYMBOLS = ["MockFactory"];
+const EXPORTED_SYMBOLS = ["MockFactory"];
 
 var MockFactory = {
   _registeredComponents: {},
   /**
    * Register a mock to override target interfaces.
    * The target interface may be accessed though _genuine property of the mock.
    *
    * @param contractID The contract ID of the interface which is overridden by
--- a/mailnews/test/resources/NetworkTestUtils.jsm
+++ b/mailnews/test/resources/NetworkTestUtils.jsm
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * This file provides utilities useful in testing more advanced networking
  * scenarios, such as proxies and SSL connections.
  */
 
-this.EXPORTED_SYMBOLS = ["NetworkTestUtils"];
+const EXPORTED_SYMBOLS = ["NetworkTestUtils"];
 
 var CC = Components.Constructor;
 
 const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 const ServerSocket = CC(
   "@mozilla.org/network/server-socket;1",
--- a/mailnews/test/resources/PromiseTestUtils.jsm
+++ b/mailnews/test/resources/PromiseTestUtils.jsm
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * This file provides utilities useful in using Promises and Task.jsm
  * with mailnews tests.
  */
 
-this.EXPORTED_SYMBOLS = ["PromiseTestUtils"];
+const EXPORTED_SYMBOLS = ["PromiseTestUtils"];
 
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 /**
  * Url listener that can wrap another listener and trigger a callback.
  *