Bug 1425048 - Enable ESLint rules no-unused-vars/no-undef for mobile/android/components/extensions/. r=geckoview-reviewers,extension-reviewers,robwu,owlish

Differential Revision: https://phabricator.services.mozilla.com/D174749
This commit is contained in:
Mark Banner 2023-04-10 18:11:03 +00:00
Родитель 37457022af
Коммит 5fb4f28a11
5 изменённых файлов: 29 добавлений и 17 удалений

Просмотреть файл

@ -4,16 +4,25 @@
"use strict";
const {
globals,
} = require("../../toolkit/components/extensions/parent/.eslintrc.js");
module.exports = {
overrides: [
{
files: [
// Bug 1425048 - mainly going away, see bug 1583370.
"components/extensions/**",
],
rules: {
"no-unused-vars": "off",
"no-undef": "off",
files: ["components/extensions/ext-*.js"],
excludedFiles: ["components/extensions/ext-c-*.js"],
globals: {
...globals,
// These globals are defined in ext-android.js and can only be used in
// the extension files that run in the parent process.
EventDispatcher: true,
ExtensionError: true,
makeGlobalEvent: true,
TabContext: true,
tabTracker: true,
windowTracker: true,
},
},
{

Просмотреть файл

@ -3,6 +3,11 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* NOTE: If you change the globals in this file, you must check if the globals
* list in mobile/android/.eslintrc.js also needs updating.
*/
ChromeUtils.defineESModuleGetters(this, {
GeckoViewTabBridge: "resource://gre/modules/GeckoViewTab.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
@ -29,8 +34,6 @@ var { DefaultWeakMap, ExtensionError } = ExtensionUtils;
var { defineLazyGetter } = ExtensionCommon;
global.GlobalEventDispatcher = EventDispatcher.instance;
const BrowserStatusFilter = Components.Constructor(
"@mozilla.org/appshell/component/browser-status-filter;1",
"nsIWebProgress",
@ -204,9 +207,9 @@ global.makeGlobalEvent = function makeGlobalEvent(
},
};
GlobalEventDispatcher.registerListener(listener2, [event]);
EventDispatcher.instance.registerListener(listener2, [event]);
return () => {
GlobalEventDispatcher.unregisterListener(listener2, [event]);
EventDispatcher.instance.unregisterListener(listener2, [event]);
};
},
}).api();

Просмотреть файл

@ -6,9 +6,6 @@
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-android.js */
XPCOMUtils.defineLazyModuleGetters(this, {
GeckoViewWebExtension: "resource://gre/modules/GeckoViewWebExtension.jsm",
ExtensionActionHelper: "resource://gre/modules/GeckoViewWebExtension.jsm",

Просмотреть файл

@ -6,9 +6,6 @@
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-android.js */
XPCOMUtils.defineLazyModuleGetters(this, {
GeckoViewWebExtension: "resource://gre/modules/GeckoViewWebExtension.jsm",
ExtensionActionHelper: "resource://gre/modules/GeckoViewWebExtension.jsm",

Просмотреть файл

@ -0,0 +1,6 @@
"use strict";
module.exports = {
extends:
"../../../../../../toolkit/components/extensions/test/xpcshell/.eslintrc.js",
};