Bug 1545831 - Use ChromeUtils.generateQI in a few more places. r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D28241

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew McCreight 2019-04-19 19:58:13 +00:00
Родитель dd528e580c
Коммит 9c94962bf5
8 изменённых файлов: 34 добавлений и 124 удалений

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

@ -22,13 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429785
const serv = Cc["@mozilla.org/consoleservice;1"]
.getService(Ci.nsIConsoleService);
var listener = {
QueryInterface : function(iid) {
if (!iid.equals(Ci.nsISupports) &&
!iid.equals(Ci.nsIConsoleListener)) {
throw Cr.NS_NOINTERFACE;
}
return this;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIConsoleListener]),
observe : function (msg) { errorLogged = true; }
};

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

@ -41,14 +41,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=434998
this.mEditor = aEditor;
},
QueryInterface : function(aIID)
{
if (aIID.equals(Ci.nsIWebProgressListener) ||
aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener,
Ci.nsISupportsWeakReference]),
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
{

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

@ -34,22 +34,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607584
{
this.init(aEditor);
}
EditorContentListener.prototype = {
init : function(aEditor)
{
this.mEditor = aEditor;
},
QueryInterface : function(aIID)
{
if (aIID.equals(Ci.nsIWebProgressListener) ||
aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener,
Ci.nsISupportsWeakReference]),
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
{
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
@ -73,24 +67,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607584
SimpleTest.finish();
}
}
},
onProgressChange : function(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress)
{
},
onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags)
{
},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
{
},
onSecurityChange : function(aWebProgress, aRequest, aState)
{
},
@ -98,7 +92,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607584
onContentBlockingEvent : function(aWebProgress, aRequest, aEvent)
{
},
mEditor: null
};

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

@ -40,14 +40,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=616590
this.mEditor = aEditor;
},
QueryInterface : function(aIID)
{
if (aIID.equals(Ci.nsIWebProgressListener) ||
aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener,
Ci.nsISupportsWeakReference]),
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
{

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

@ -36,22 +36,16 @@ adapted from test_bug607584.xul by Kent James <kent@caspia.com>
{
this.init(aEditor);
}
EditorContentListener.prototype = {
init : function(aEditor)
{
this.mEditor = aEditor;
},
QueryInterface : function(aIID)
{
if (aIID.equals(Ci.nsIWebProgressListener) ||
aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener,
Ci.nsISupportsWeakReference]),
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
{
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)

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

@ -25,14 +25,8 @@ nsLDBBrowserContentListener.prototype = {
this.mStopButton = document.getElementById("stop-button");
},
QueryInterface : function(aIID)
{
if (aIID.equals(Ci.nsIWebProgressListener) ||
aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener,
Ci.nsISupportsWeakReference]),
// nsIWebProgressListener implementation
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)

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

@ -25,12 +25,7 @@ var prefs = Cc["@mozilla.org/preferences-service;1"]
function TestProtocolHandler() {
}
TestProtocolHandler.prototype = {
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIProtocolHandler) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolHandler]),
scheme: "moz-test",
defaultPort: -1,
protocolFlags: Ci.nsIProtocolHandler.URI_NOAUTH |
@ -106,12 +101,7 @@ TestFilter.prototype = {
_async: false,
_throwing: false,
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIProtocolProxyFilter) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolProxyFilter]),
applyFilter: function(pps, uri, pi, cb) {
if (this._result == THROW) {
@ -137,13 +127,7 @@ function resolveCallback() { }
resolveCallback.prototype = {
nextFunction: null,
QueryInterface : function (iid) {
const interfaces = [Ci.nsIProtocolProxyCallback,
Ci.nsISupports];
if (!interfaces.some( function(v) { return iid.equals(v) } ))
throw Cr.NS_ERROR_NO_INTERFACE;
return this;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolProxyCallback]),
onProxyAvailable : function (req, channel, pi, status) {
this.nextFunction(pi);

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

@ -36,12 +36,7 @@ var prefs = Cc["@mozilla.org/preferences-service;1"]
function TestProtocolHandler() {
}
TestProtocolHandler.prototype = {
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIProtocolHandler) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolHandler]),
scheme: "moz-test",
defaultPort: -1,
protocolFlags: Ci.nsIProtocolHandler.URI_NOAUTH |
@ -109,12 +104,7 @@ TestFilter.prototype = {
_port: -1,
_flags: 0,
_timeout: 0,
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIProtocolProxyFilter) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolProxyFilter]),
applyFilter: function(pps, uri, pi, cb) {
var pi_tail = pps.newProxyInfo(this._type, this._host, this._port,
this._flags, this._timeout, null);
@ -128,12 +118,7 @@ TestFilter.prototype = {
function BasicFilter() {}
BasicFilter.prototype = {
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIProtocolProxyFilter) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolProxyFilter]),
applyFilter: function(pps, uri, pi, cb) {
cb.onProxyFilterResult(
pps.newProxyInfo("http", "localhost", 8080, 0, 10,
@ -144,12 +129,7 @@ BasicFilter.prototype = {
function BasicChannelFilter() {}
BasicChannelFilter.prototype = {
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIProtocolProxyChannelFilter) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolProxyChannelFilter]),
applyFilter: function(pps, channel, pi, cb) {
cb.onProxyFilterResult(
pps.newProxyInfo("http", channel.URI.host, 7777, 0, 10,
@ -162,13 +142,7 @@ function resolveCallback() { }
resolveCallback.prototype = {
nextFunction: null,
QueryInterface : function (iid) {
const interfaces = [Ci.nsIProtocolProxyCallback,
Ci.nsISupports];
if (!interfaces.some( function(v) { return iid.equals(v) } ))
throw Cr.NS_ERROR_NO_INTERFACE;
return this;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolProxyCallback]),
onProxyAvailable : function (req, channel, pi, status) {
this.nextFunction(pi);
@ -491,13 +465,7 @@ function TestResolveCallback(type, nexttest) {
this.nexttest = nexttest;
}
TestResolveCallback.prototype = {
QueryInterface:
function TestResolveCallback_QueryInterface(iid) {
if (iid.equals(Ci.nsIProtocolProxyCallback) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolProxyCallback]),
onProxyAvailable:
function TestResolveCallback_onProxyAvailable(req, channel, pi, status) {
@ -658,13 +626,7 @@ function finish_pac_test() {
function TestResolveCancelationCallback() {
}
TestResolveCancelationCallback.prototype = {
QueryInterface:
function TestResolveCallback_QueryInterface(iid) {
if (iid.equals(Ci.nsIProtocolProxyCallback) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolProxyCallback]),
onProxyAvailable:
function TestResolveCancelationCallback_onProxyAvailable(req, channel, pi, status) {