зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1456035: Part 3 - Replace XPCOMUtils.generateQI with a stub for ChromeUtils.generateQI. r=mccr8
MozReview-Commit-ID: HWnlxUQvxYZ --HG-- extra : rebase_source : a5801a0d7427a2cf3cedec2a4e8db1a3d80273ec
This commit is contained in:
Родитель
8b53374e1d
Коммит
e318b76d56
|
@ -101,18 +101,7 @@ var XPCOMUtils = {
|
|||
* property.
|
||||
*/
|
||||
generateQI: function XPCU_generateQI(interfaces) {
|
||||
/* Note that Ci[Ci.x] == Ci.x for all x */
|
||||
let a = [];
|
||||
if (interfaces) {
|
||||
for (let i = 0; i < interfaces.length; i++) {
|
||||
let iface = interfaces[i];
|
||||
let name = (iface && iface.name) || String(iface);
|
||||
if (name in Ci) {
|
||||
a.push(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return makeQI(a);
|
||||
return ChromeUtils.generateQI(interfaces);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -578,21 +567,3 @@ ChromeUtils.defineModuleGetter(this, "Services",
|
|||
XPCOMUtils.defineLazyServiceGetter(XPCOMUtils, "categoryManager",
|
||||
"@mozilla.org/categorymanager;1",
|
||||
"nsICategoryManager");
|
||||
|
||||
/**
|
||||
* Helper for XPCOMUtils.generateQI to avoid leaks - see bug 381651#c1
|
||||
*/
|
||||
function makeQI(interfaceNames) {
|
||||
return function XPCOMUtils_QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsISupports))
|
||||
return this;
|
||||
if (iid.equals(Ci.nsIClassInfo) && "classInfo" in this)
|
||||
return this.classInfo;
|
||||
for (let i = 0; i < interfaceNames.length; i++) {
|
||||
if (Ci[interfaceNames[i]].equals(iid))
|
||||
return this;
|
||||
}
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -47,7 +47,13 @@ add_test(function test_generateCI()
|
|||
const classDescription = "generateCI test component";
|
||||
const flags = Ci.nsIClassInfo.DOM_OBJECT;
|
||||
var x = {
|
||||
QueryInterface: XPCOMUtils.generateQI([]),
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIClassInfo))
|
||||
return this.classInfo;
|
||||
if (iid.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
classInfo: XPCOMUtils.generateCI({classID: classID,
|
||||
interfaces: [],
|
||||
flags: flags,
|
||||
|
|
|
@ -2684,7 +2684,7 @@ var GuidHelper = {
|
|||
this.updateCache(aParentId, aParentGuid);
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI(Ci.nsINavBookmarkObserver),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver]),
|
||||
|
||||
onBeginUpdateBatch() {},
|
||||
onEndUpdateBatch() {},
|
||||
|
|
Загрузка…
Ссылка в новой задаче