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:
Bobby Holley 2014-09-08 13:36:20 -07:00
parent 00f21621a1
commit 86df050cfc
4 changed files with 8 additions and 8 deletions

View File

@ -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() {

View File

@ -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 {

View File

@ -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) {

View File

@ -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) {