Bug 1609760 - Stop assigning properties to the global `this` in common/ JSMs (port bug 1608278). r=pmorris
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Sun, 26 Apr 2020 12:42:45 +0300
changeset 38935 91432c993ab3a1e95fb031e336053d3d89155005
parent 38934 353338823ec92cf01259b8b33b13e8de79fa96ce
child 38936 f94827e5dd8e16bf8d9a04314c040cbf92ad1cd0
push id401
push userclokep@gmail.com
push dateMon, 01 Jun 2020 20:41:59 +0000
reviewerspmorris
bugs1609760, 1608278
Bug 1609760 - Stop assigning properties to the global `this` in common/ JSMs (port bug 1608278). r=pmorris cp ../.gitignore .rgignore && rg -l -g '*.jsm' '' common | 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)
common/src/ChromeManifest.jsm
common/src/ExtensionSupport.jsm
--- a/common/src/ChromeManifest.jsm
+++ b/common/src/ChromeManifest.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 = ["ChromeManifest"];
+const EXPORTED_SYMBOLS = ["ChromeManifest"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /**
  * A parser for chrome.manifest files. Implements a subset of
  * https://developer.mozilla.org/en-US/docs/Mozilla/Chrome_Registration
  */
 class ChromeManifest {
--- a/common/src/ExtensionSupport.jsm
+++ b/common/src/ExtensionSupport.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/. */
 
 /**
  * Helper functions for use by extensions that should ease them plug
  * into the application.
  */
 
-this.EXPORTED_SYMBOLS = ["ExtensionSupport"];
+const EXPORTED_SYMBOLS = ["ExtensionSupport"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var extensionHooks = new Map();
 var openWindowList;
 
 var ExtensionSupport = {
   /**