Bug 1854913 - Turn off ESLint rule mozilla/use-chromeutils-generateqi for plain mochitests as it should not apply there. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D189099
This commit is contained in:
Mark Banner 2023-09-26 13:38:20 +00:00
Родитель 398079efd9
Коммит adc07ece4e
7 изменённых файлов: 5 добавлений и 14 удалений

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

@ -351,7 +351,6 @@ module.exports = {
"mozilla/no-arbitrary-setTimeout": "off", "mozilla/no-arbitrary-setTimeout": "off",
"mozilla/no-define-cc-etc": "off", "mozilla/no-define-cc-etc": "off",
"mozilla/prefer-boolean-length-check": "off", "mozilla/prefer-boolean-length-check": "off",
"mozilla/use-chromeutils-generateqi": "off",
"mozilla/use-default-preference-values": "off", "mozilla/use-default-preference-values": "off",
"mozilla/use-includes-instead-of-indexOf": "off", "mozilla/use-includes-instead-of-indexOf": "off",
"mozilla/use-services": "off", "mozilla/use-services": "off",
@ -439,7 +438,6 @@ module.exports = {
"mozilla/no-define-cc-etc": "off", "mozilla/no-define-cc-etc": "off",
"mozilla/reject-importGlobalProperties": "off", "mozilla/reject-importGlobalProperties": "off",
"mozilla/use-cc-etc": "off", "mozilla/use-cc-etc": "off",
"mozilla/use-chromeutils-generateqi": "off",
"mozilla/use-includes-instead-of-indexOf": "off", "mozilla/use-includes-instead-of-indexOf": "off",
"mozilla/use-ownerGlobal": "off", "mozilla/use-ownerGlobal": "off",
"mozilla/use-services": "off", "mozilla/use-services": "off",
@ -580,7 +578,6 @@ module.exports = {
rules: { rules: {
"mozilla/no-useless-parameters": "off", "mozilla/no-useless-parameters": "off",
"mozilla/no-useless-removeEventListener": "off", "mozilla/no-useless-removeEventListener": "off",
"mozilla/use-chromeutils-generateqi": "off",
"mozilla/use-services": "off", "mozilla/use-services": "off",
complexity: "off", complexity: "off",
"no-array-constructor": "off", "no-array-constructor": "off",

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

@ -35,7 +35,6 @@ var policyID = SpecialPowers.wrap(SpecialPowers.Components).ID("{b80e19d0-878f-d
var policyName = "@mozilla.org/testpolicy;1"; var policyName = "@mozilla.org/testpolicy;1";
var policy = { var policy = {
// nsISupports implementation // nsISupports implementation
// eslint-disable-next-line mozilla/use-chromeutils-generateqi
QueryInterface(iid) { QueryInterface(iid) {
iid = SpecialPowers.wrap(iid); iid = SpecialPowers.wrap(iid);
if (iid.equals(Ci.nsISupports) || if (iid.equals(Ci.nsISupports) ||

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

@ -34,13 +34,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=874090
this.showAlert(); this.showAlert();
}, },
QueryInterface: function(aIID) { QueryInterface: ChromeUtils.generateQI(["nsIAlertsService"]),
if (aIID.equals(Ci.nsISupports) ||
aIID.equals(Ci.nsIAlertsService)) {
return this;
}
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
createInstance: function(aIID) { createInstance: function(aIID) {
return this.QueryInterface(aIID); return this.QueryInterface(aIID);

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

@ -1,4 +1,3 @@
/* eslint-disable mozilla/use-chromeutils-generateqi */
var MockServices = (function () { var MockServices = (function () {
"use strict"; "use strict";

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

@ -23,7 +23,6 @@ var obs = Cc["@mozilla.org/observer-service;1"].getService();
obs = obs.QueryInterface(Ci.nsIObserverService); obs = obs.QueryInterface(Ci.nsIObserverService);
var observer = { var observer = {
/* eslint-disable-next-line mozilla/use-chromeutils-generateqi */
QueryInterface (aIID) { QueryInterface (aIID) {
if (aIID.equals(Ci.nsISupports) || if (aIID.equals(Ci.nsISupports) ||
aIID.equals(Ci.nsIObserver)) aIID.equals(Ci.nsIObserver))

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

@ -54,6 +54,9 @@ module.exports = {
// We mis-predict globals for HTML test files in directories shared // We mis-predict globals for HTML test files in directories shared
// with browser tests, so don't try to "fix" imports that are needed. // with browser tests, so don't try to "fix" imports that are needed.
"mozilla/no-redeclare-with-import-autofix": "off", "mozilla/no-redeclare-with-import-autofix": "off",
// Turn off use-chromeutils-generateqi as these tests don't have ChromeUtils
// available.
"mozilla/use-chromeutils-generateqi": "off",
"no-shadow": "error", "no-shadow": "error",
}, },
}; };

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

@ -48,7 +48,7 @@ module.exports = {
fixable: "code", fixable: "code",
messages: { messages: {
noJSQueryInterface: noJSQueryInterface:
"Please use ChromeUtils.generateQI rather than" + "Please use ChromeUtils.generateQI rather than " +
"manually creating JavaScript QueryInterface functions", "manually creating JavaScript QueryInterface functions",
noXpcomUtilsGenerateQI: noXpcomUtilsGenerateQI:
"Please use ChromeUtils.generateQI instead of XPCOMUtils.generateQI", "Please use ChromeUtils.generateQI instead of XPCOMUtils.generateQI",