From cd1237608a496f4ad7007956714e42091311667a Mon Sep 17 00:00:00 2001 From: "mattwillis@gmail.com" Date: Tue, 18 Sep 2007 15:11:31 -0700 Subject: [PATCH] bug 396119 - Fix minor errors in XPCOMUtils.jsm. Patch by Manish Singh , r1=gavin, r2=sayrer --- js/src/xpconnect/loader/XPCOMUtils.jsm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/js/src/xpconnect/loader/XPCOMUtils.jsm b/js/src/xpconnect/loader/XPCOMUtils.jsm index 54b792c3d31..f5487f16cb7 100644 --- a/js/src/xpconnect/loader/XPCOMUtils.jsm +++ b/js/src/xpconnect/loader/XPCOMUtils.jsm @@ -102,6 +102,7 @@ EXPORTED_SYMBOLS = [ "XPCOMUtils" ]; const Ci = Components.interfaces; +const Cr = Components.results; var XPCOMUtils = { /** @@ -152,15 +153,16 @@ var XPCOMUtils = { return { // nsIModule impl. getClassObject: function(compMgr, cid, iid) { + // We only support nsIFactory queries, not nsIClassInfo if (!iid.equals(Ci.nsIFactory)) - throw Components.results.NS_ERROR_NO_INTERFACE; + throw Cr.NS_ERROR_NOT_IMPLEMENTED; for each (let classDesc in classes) { if (classDesc.cid.equals(cid)) return classDesc.factory; } - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + throw Cr.NS_ERROR_FACTORY_NOT_REGISTERED; }, registerSelf: function(compMgr, fileSpec, location, type) { @@ -207,7 +209,8 @@ var XPCOMUtils = { let catMan = XPCOMUtils.categoryManager; for each (let cat in classDesc.categories) { catMan.deleteCategoryEntry(cat.category, - cat.entry || classDesc.className); + cat.entry || classDesc.className, + true); } } compMgr.unregisterFactoryLocation(classDesc.cid, fileSpec); @@ -237,8 +240,8 @@ var XPCOMUtils = { if (!factory) { factory = { createInstance: function(outer, iid) { - if(outer) - throw CR.NS_ERROR_NO_AGGREGATION; + if (outer) + throw Cr.NS_ERROR_NO_AGGREGATION; return (new component()).QueryInterface(iid); } } @@ -259,6 +262,6 @@ function makeQI(interfaceNames) { return this; } - throw Components.results.NS_ERROR_NO_INTERFACE; + throw Cr.NS_ERROR_NO_INTERFACE; }; }