mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1062631 - Use SpecialPowers.wrapCallback for QI in more tests. r=bz
Otherwise the QI throws as soon as it tries to pass the IID into content code.
This commit is contained in:
parent
00f21621a1
commit
86df050cfc
@ -49,12 +49,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=502673
|
||||
}
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
QueryInterface: SpecialPowers.wrapCallback(function(iid) {
|
||||
if (iid.equals(SpecialPowers.Ci.nsIDocumentStateListener) ||
|
||||
iid.equals(SpecialPowers.Ci.nsISupports))
|
||||
return this;
|
||||
throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
function doTest() {
|
||||
|
@ -23,14 +23,14 @@ function startCallbackTimer() {
|
||||
|
||||
|
||||
var observer = {
|
||||
QueryInterface : function (iid) {
|
||||
QueryInterface : SpecialPowers.wrapCallback(function (iid) {
|
||||
const interfaces = [Ci.nsIObserver,
|
||||
Ci.nsISupports, Ci.nsISupportsWeakReference];
|
||||
|
||||
if (!interfaces.some( function(v) { return iid.equals(v) } ))
|
||||
throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
},
|
||||
}),
|
||||
|
||||
observe : SpecialPowers.wrapCallback(function (subject, topic, data) {
|
||||
try {
|
||||
|
@ -33,14 +33,14 @@ function loadTestFrame() {
|
||||
|
||||
function doUpdate(update) {
|
||||
var listener = {
|
||||
QueryInterface: function(iid)
|
||||
QueryInterface: SpecialPowers.wrapCallback(function(iid)
|
||||
{
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIUrlClassifierUpdateObserver))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
}),
|
||||
updateUrlRequested: function(url) { },
|
||||
streamFinished: function(status) { },
|
||||
updateError: function(errorCode) {
|
||||
|
@ -28,14 +28,14 @@ var dbService = Cc["@mozilla.org/url-classifier/dbservice;1"]
|
||||
|
||||
function doUpdate(update) {
|
||||
var listener = {
|
||||
QueryInterface: function(iid)
|
||||
QueryInterface: SpecialPowers.wrapCallback(function(iid)
|
||||
{
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIUrlClassifierUpdateObserver))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
}),
|
||||
updateUrlRequested: function(url) { },
|
||||
streamFinished: function(status) { },
|
||||
updateError: function(errorCode) {
|
||||
|
Loading…
Reference in New Issue
Block a user