Loading devtools/client/performance-new/popup/background.jsm.js +1 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ const CURRENT_WEBCHANNEL_VERSION = 1; // Lazily load the require function, when it's needed. ChromeUtils.defineModuleGetter( // eslint-disable-next-line mozilla/reject-global-this this, "require", "resource://devtools/shared/loader/Loader.jsm" Loading docs/code-quality/lint/linters/eslint-plugin-mozilla.rst +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ The plugin implements the following rules: eslint-plugin-mozilla/prefer-formatValues eslint-plugin-mozilla/reject-addtask-only eslint-plugin-mozilla/reject-chromeutils-import-params eslint-plugin-mozilla/reject-global-this eslint-plugin-mozilla/reject-importGlobalProperties eslint-plugin-mozilla/reject-osfile eslint-plugin-mozilla/reject-relative-requires Loading docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-global-this.rst 0 → 100644 +29 −0 Original line number Diff line number Diff line reject-global-this ====================== Rejects global ``this`` usage in JSM files. The global ``this`` is not available in ESM, and this is a preparation for the migration. Examples of incorrect code for this rule: ----------------------------------------- .. code-block:: js this.EXPORTED_SYMBOLS = ["foo"]; XPCOMUtils.defineLazyModuleGetters(this, { AddonManager: "resource://gre/modules/AddonManager.jsm", }); Examples of correct code for this rule: --------------------------------------- .. code-block:: js const EXPORTED_SYMBOLS = ["foo"]; const lazy = {}; XPCOMUtils.defineLazyModuleGetters(lazy, { AddonManager: "resource://gre/modules/AddonManager.jsm", }); mobile/android/modules/geckoview/AndroidLog.jsm +3 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,9 @@ if (typeof Components != "undefined") { // Specify exported symbols for JSM module loader. // // (bug 1773390) // eslint-disable-next-line mozilla/reject-global-this this.EXPORTED_SYMBOLS = ["AndroidLog"]; var { ctypes } = ChromeUtils.import("resource://gre/modules/ctypes.jsm"); } Loading toolkit/components/osfile/modules/osfile_shared_allthreads.jsm +4 −0 Original line number Diff line number Diff line Loading @@ -35,8 +35,10 @@ if (typeof Components != "undefined") { // Global definition of |exports|, to keep everybody happy. // In non-main thread, |exports| is provided by the module // loader. // eslint-disable-next-line mozilla/reject-global-this this.exports = {}; ({ Services } = ChromeUtils.import("resource://gre/modules/Services.jsm")); // eslint-disable-next-line mozilla/reject-global-this this.Services = Services; Meta = ChromeUtils.import("resource://gre/modules/PromiseWorker.jsm") .BasePromiseWorker.Meta; Loading Loading @@ -1362,8 +1364,10 @@ Object.defineProperty(exports.OS.Shared, "TEST", { // /////////////////// Permanent boilerplate if (typeof Components != "undefined") { // eslint-disable-next-line mozilla/reject-global-this this.EXPORTED_SYMBOLS = EXPORTED_SYMBOLS; for (let symbol of EXPORTED_SYMBOLS) { // eslint-disable-next-line mozilla/reject-global-this this[symbol] = exports[symbol]; } } Loading
devtools/client/performance-new/popup/background.jsm.js +1 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ const CURRENT_WEBCHANNEL_VERSION = 1; // Lazily load the require function, when it's needed. ChromeUtils.defineModuleGetter( // eslint-disable-next-line mozilla/reject-global-this this, "require", "resource://devtools/shared/loader/Loader.jsm" Loading
docs/code-quality/lint/linters/eslint-plugin-mozilla.rst +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ The plugin implements the following rules: eslint-plugin-mozilla/prefer-formatValues eslint-plugin-mozilla/reject-addtask-only eslint-plugin-mozilla/reject-chromeutils-import-params eslint-plugin-mozilla/reject-global-this eslint-plugin-mozilla/reject-importGlobalProperties eslint-plugin-mozilla/reject-osfile eslint-plugin-mozilla/reject-relative-requires Loading
docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-global-this.rst 0 → 100644 +29 −0 Original line number Diff line number Diff line reject-global-this ====================== Rejects global ``this`` usage in JSM files. The global ``this`` is not available in ESM, and this is a preparation for the migration. Examples of incorrect code for this rule: ----------------------------------------- .. code-block:: js this.EXPORTED_SYMBOLS = ["foo"]; XPCOMUtils.defineLazyModuleGetters(this, { AddonManager: "resource://gre/modules/AddonManager.jsm", }); Examples of correct code for this rule: --------------------------------------- .. code-block:: js const EXPORTED_SYMBOLS = ["foo"]; const lazy = {}; XPCOMUtils.defineLazyModuleGetters(lazy, { AddonManager: "resource://gre/modules/AddonManager.jsm", });
mobile/android/modules/geckoview/AndroidLog.jsm +3 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,9 @@ if (typeof Components != "undefined") { // Specify exported symbols for JSM module loader. // // (bug 1773390) // eslint-disable-next-line mozilla/reject-global-this this.EXPORTED_SYMBOLS = ["AndroidLog"]; var { ctypes } = ChromeUtils.import("resource://gre/modules/ctypes.jsm"); } Loading
toolkit/components/osfile/modules/osfile_shared_allthreads.jsm +4 −0 Original line number Diff line number Diff line Loading @@ -35,8 +35,10 @@ if (typeof Components != "undefined") { // Global definition of |exports|, to keep everybody happy. // In non-main thread, |exports| is provided by the module // loader. // eslint-disable-next-line mozilla/reject-global-this this.exports = {}; ({ Services } = ChromeUtils.import("resource://gre/modules/Services.jsm")); // eslint-disable-next-line mozilla/reject-global-this this.Services = Services; Meta = ChromeUtils.import("resource://gre/modules/PromiseWorker.jsm") .BasePromiseWorker.Meta; Loading Loading @@ -1362,8 +1364,10 @@ Object.defineProperty(exports.OS.Shared, "TEST", { // /////////////////// Permanent boilerplate if (typeof Components != "undefined") { // eslint-disable-next-line mozilla/reject-global-this this.EXPORTED_SYMBOLS = EXPORTED_SYMBOLS; for (let symbol of EXPORTED_SYMBOLS) { // eslint-disable-next-line mozilla/reject-global-this this[symbol] = exports[symbol]; } }