Bug 1460092: Add ESLint rule to enforce use of ChromeUtils.generateQI. r=Gijs
Also fixes existing code which fails the rule. MozReview-Commit-ID: CkLFgsspGMU
This commit is contained in:
@@ -46,12 +46,7 @@ classifierHelper.waitForInit = function() {
|
||||
}, "mozentries-update-finished");
|
||||
|
||||
let listener = {
|
||||
QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIUrlClassifierUpdateObserver))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIUrlClassifierUpdateObserver"]),
|
||||
|
||||
handleEvent(value) {
|
||||
if (value === table) {
|
||||
@@ -137,13 +132,7 @@ classifierHelper._update = function(update) {
|
||||
try {
|
||||
await new Promise((resolve, reject) => {
|
||||
let listener = {
|
||||
QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIUrlClassifierUpdateObserver))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIUrlClassifierUpdateObserver"]),
|
||||
updateUrlRequested(url) { },
|
||||
streamFinished(status) { },
|
||||
updateError(errorCode) {
|
||||
|
||||
@@ -18,13 +18,7 @@ function setTimeout(callback, delay) {
|
||||
|
||||
function doUpdate(update) {
|
||||
let listener = {
|
||||
QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIUrlClassifierUpdateObserver))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIUrlClassifierUpdateObserver"]),
|
||||
updateUrlRequested(url) { },
|
||||
streamFinished(status) { },
|
||||
updateError(errorCode) {
|
||||
@@ -74,12 +68,7 @@ function waitForInit() {
|
||||
Services.io.newURI(url), {});
|
||||
|
||||
let listener = {
|
||||
QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIUrlClassifierUpdateObserver))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIUrlClassifierUpdateObserver"]),
|
||||
|
||||
handleEvent(value) {
|
||||
if (value === table) {
|
||||
|
||||
@@ -139,12 +139,7 @@ function buildBareUpdate(chunks, hashSize) {
|
||||
*/
|
||||
function doSimpleUpdate(updateText, success, failure) {
|
||||
var listener = {
|
||||
QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIUrlClassifierUpdateObserver))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIUrlClassifierUpdateObserver"]),
|
||||
|
||||
updateUrlRequested(url) { },
|
||||
streamFinished(status) { },
|
||||
@@ -164,12 +159,7 @@ function doSimpleUpdate(updateText, success, failure) {
|
||||
*/
|
||||
function doErrorUpdate(tables, success, failure) {
|
||||
var listener = {
|
||||
QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIUrlClassifierUpdateObserver))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIUrlClassifierUpdateObserver"]),
|
||||
|
||||
updateUrlRequested(url) { },
|
||||
streamFinished(status) { },
|
||||
@@ -361,12 +351,7 @@ function Timer(delay, cb) {
|
||||
}
|
||||
|
||||
Timer.prototype = {
|
||||
QueryInterface(iid) {
|
||||
if (!iid.equals(Ci.nsISupports) && !iid.equals(Ci.nsITimerCallback)) {
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI(["nsITimerCallback"]),
|
||||
notify(timer) {
|
||||
this.cb();
|
||||
}
|
||||
|
||||
@@ -11,13 +11,7 @@ function DummyCompleter() {
|
||||
|
||||
DummyCompleter.prototype =
|
||||
{
|
||||
QueryInterface(iid) {
|
||||
if (!iid.equals(Ci.nsISupports) &&
|
||||
!iid.equals(Ci.nsIUrlClassifierHashCompleter)) {
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIUrlClassifierHashCompleter"]),
|
||||
|
||||
complete(partialHash, gethashUrl, tableName, cb) {
|
||||
this.queries.push(partialHash);
|
||||
|
||||
@@ -214,13 +214,7 @@ function Observer(callback) {
|
||||
|
||||
Observer.prototype =
|
||||
{
|
||||
QueryInterface(iid) {
|
||||
if (!iid.equals(Ci.nsISupports) &&
|
||||
!iid.equals(Ci.nsIObserver)) {
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIObserver"])
|
||||
};
|
||||
|
||||
// Tests a database reset request.
|
||||
|
||||
Reference in New Issue
Block a user