Bug 1445813 - Allow globalThis as a second parameter to defineLazyScriptGetter and friends. r=mconley
authorMark Banner <standard8@mozilla.com>
Tue, 21 Sep 2021 12:42:37 +0000
changeset 592638 4d92ec21fbb0c65028ba467f4ea96afe47883010
parent 592637 298b1f6d8b76cf59eaafca14a21a436c7f3431f6
child 592639 57c67486fd1f27d2f41bba4beeeea89c9a01ddc5
push id38811
push usernbeleuzu@mozilla.com
push dateWed, 22 Sep 2021 04:09:13 +0000
treeherdermozilla-central@b6fd43458638 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1445813
milestone94.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1445813 - Allow globalThis as a second parameter to defineLazyScriptGetter and friends. r=mconley Differential Revision: https://phabricator.services.mozilla.com/D126071
tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
tools/lint/eslint/eslint-plugin-mozilla/package.json
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
@@ -15,44 +15,48 @@ const fs = require("fs");
 const ini = require("multi-ini");
 const recommendedConfig = require("./configs/recommended");
 
 var gModules = null;
 var gRootDir = null;
 var directoryManifests = new Map();
 
 const callExpressionDefinitions = [
-  /^loader\.lazyGetter\(this, "(\w+)"/,
-  /^loader\.lazyImporter\(this, "(\w+)"/,
-  /^loader\.lazyServiceGetter\(this, "(\w+)"/,
-  /^loader\.lazyRequireGetter\(this, "(\w+)"/,
-  /^XPCOMUtils\.defineLazyGetter\(this, "(\w+)"/,
-  /^XPCOMUtils\.defineLazyModuleGetter\(this, "(\w+)"/,
-  /^ChromeUtils\.defineModuleGetter\(this, "(\w+)"/,
-  /^XPCOMUtils\.defineLazyPreferenceGetter\(this, "(\w+)"/,
-  /^XPCOMUtils\.defineLazyProxy\(this, "(\w+)"/,
-  /^XPCOMUtils\.defineLazyScriptGetter\(this, "(\w+)"/,
-  /^XPCOMUtils\.defineLazyServiceGetter\(this, "(\w+)"/,
-  /^XPCOMUtils\.defineConstant\(this, "(\w+)"/,
-  /^DevToolsUtils\.defineLazyModuleGetter\(this, "(\w+)"/,
-  /^DevToolsUtils\.defineLazyGetter\(this, "(\w+)"/,
-  /^Object\.defineProperty\(this, "(\w+)"/,
-  /^Reflect\.defineProperty\(this, "(\w+)"/,
+  /^loader\.lazyGetter\((?:globalThis|this), "(\w+)"/,
+  /^loader\.lazyImporter\((?:globalThis|this), "(\w+)"/,
+  /^loader\.lazyServiceGetter\((?:globalThis|this), "(\w+)"/,
+  /^loader\.lazyRequireGetter\((?:globalThis|this), "(\w+)"/,
+  /^XPCOMUtils\.defineLazyGetter\((?:globalThis|this), "(\w+)"/,
+  /^XPCOMUtils\.defineLazyModuleGetter\((?:globalThis|this), "(\w+)"/,
+  /^ChromeUtils\.defineModuleGetter\((?:globalThis|this), "(\w+)"/,
+  /^XPCOMUtils\.defineLazyPreferenceGetter\((?:globalThis|this), "(\w+)"/,
+  /^XPCOMUtils\.defineLazyProxy\((?:globalThis|this), "(\w+)"/,
+  /^XPCOMUtils\.defineLazyScriptGetter\((?:globalThis|this), "(\w+)"/,
+  /^XPCOMUtils\.defineLazyServiceGetter\((?:globalThis|this), "(\w+)"/,
+  /^XPCOMUtils\.defineConstant\((?:globalThis|this), "(\w+)"/,
+  /^DevToolsUtils\.defineLazyModuleGetter\((?:globalThis|this), "(\w+)"/,
+  /^DevToolsUtils\.defineLazyGetter\((?:globalThis|this), "(\w+)"/,
+  /^Object\.defineProperty\((?:globalThis|this), "(\w+)"/,
+  /^Reflect\.defineProperty\((?:globalThis|this), "(\w+)"/,
   /^this\.__defineGetter__\("(\w+)"/,
 ];
 
 const callExpressionMultiDefinitions = [
   "XPCOMUtils.defineLazyGlobalGetters(this,",
+  "XPCOMUtils.defineLazyGlobalGetters(globalThis,",
   "XPCOMUtils.defineLazyModuleGetters(this,",
+  "XPCOMUtils.defineLazyModuleGetters(globalThis,",
   "XPCOMUtils.defineLazyServiceGetters(this,",
+  "XPCOMUtils.defineLazyServiceGetters(globalThis,",
   "loader.lazyRequireGetter(this,",
+  "loader.lazyRequireGetter(globalThis,",
 ];
 
 const imports = [
-  /^(?:Cu|Components\.utils|ChromeUtils)\.import\(".*\/((.*?)\.jsm?)", this\)/,
+  /^(?:Cu|Components\.utils|ChromeUtils)\.import\(".*\/((.*?)\.jsm?)", (?:globalThis|this)\)/,
 ];
 
 const workerImportFilenameMatch = /(.*\/)*((.*?)\.jsm?)/;
 
 module.exports = {
   get iniParser() {
     if (!this._iniParser) {
       this._iniParser = new ini.Parser();
--- a/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
@@ -1,11 +1,11 @@
 {
   "name": "eslint-plugin-mozilla",
-  "version": "2.11.0",
+  "version": "2.11.1",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
     "@babel/code-frame": {
       "version": "7.14.5",
       "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz",
       "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==",
       "requires": {
--- a/tools/lint/eslint/eslint-plugin-mozilla/package.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package.json
@@ -1,11 +1,11 @@
 {
   "name": "eslint-plugin-mozilla",
-  "version": "2.11.0",
+  "version": "2.11.1",
   "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
   "keywords": [
     "eslint",
     "eslintplugin",
     "eslint-plugin",
     "mozilla",
     "firefox"
   ],