diff --git a/mozilla/xpcom/components/nsComponentManager.cpp b/mozilla/xpcom/components/nsComponentManager.cpp index 168d364c62c..9265389b0c5 100644 --- a/mozilla/xpcom/components/nsComponentManager.cpp +++ b/mozilla/xpcom/components/nsComponentManager.cpp @@ -217,6 +217,9 @@ nsGetServiceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr) con { nsresult rv; nsXPIDLCString value; + nsCOMPtr serviceManager = + do_QueryInterface(mServiceManager); + // XXX Should we use the provided service manager? nsCOMPtr catman = do_GetService(kCategoryManagerCID, &rv); if (NS_FAILED(rv)) goto error; @@ -233,8 +236,8 @@ nsGetServiceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr) con rv = NS_ERROR_SERVICE_NOT_AVAILABLE; goto error; } - if (mServiceManager) { - rv = mServiceManager->GetServiceByContractID(value, aIID, (void**)aInstancePtr); + if (serviceManager) { + rv = serviceManager->GetServiceByContractID(value, aIID, (void**)aInstancePtr); } else { nsCOMPtr mgr; NS_GetServiceManager(getter_AddRefs(mgr)); diff --git a/mozilla/xpcom/components/nsIServiceManagerUtils.h b/mozilla/xpcom/components/nsIServiceManagerUtils.h index b225b6a2e8d..5e3ac6885b0 100644 --- a/mozilla/xpcom/components/nsIServiceManagerUtils.h +++ b/mozilla/xpcom/components/nsIServiceManagerUtils.h @@ -49,7 +49,7 @@ class NS_COM nsGetServiceByCID : public nsCOMPtr_helper public: nsGetServiceByCID( const nsCID& aCID, nsISupports* aServiceManager, nsresult* aErrorPtr ) : mCID(aCID), - mServiceManager( do_QueryInterface(aServiceManager) ), + mServiceManager(aServiceManager), mErrorPtr(aErrorPtr) { // nothing else to do @@ -59,7 +59,7 @@ class NS_COM nsGetServiceByCID : public nsCOMPtr_helper private: const nsCID& mCID; - nsCOMPtr mServiceManager; + nsISupports* mServiceManager; nsresult* mErrorPtr; }; @@ -82,7 +82,7 @@ class NS_COM nsGetServiceByContractID : public nsCOMPtr_helper public: nsGetServiceByContractID( const char* aContractID, nsISupports* aServiceManager, nsresult* aErrorPtr ) : mContractID(aContractID), - mServiceManager( do_QueryInterface(aServiceManager) ), + mServiceManager(aServiceManager), mErrorPtr(aErrorPtr) { // nothing else to do @@ -92,7 +92,7 @@ class NS_COM nsGetServiceByContractID : public nsCOMPtr_helper private: const char* mContractID; - nsCOMPtr mServiceManager; + nsISupports* mServiceManager; nsresult* mErrorPtr; }; @@ -118,7 +118,7 @@ class nsGetServiceFromCategory : public nsCOMPtr_helper nsresult* aErrorPtr) : mCategory(aCategory), mEntry(aEntry), - mServiceManager( do_QueryInterface(aServiceManager) ), + mServiceManager(aServiceManager), mErrorPtr(aErrorPtr) { // nothing else to do @@ -128,7 +128,7 @@ class nsGetServiceFromCategory : public nsCOMPtr_helper protected: const char* mCategory; const char* mEntry; - nsCOMPtr mServiceManager; + nsISupports* mServiceManager; nsresult* mErrorPtr; }; diff --git a/mozilla/xpcom/glue/nsComponentManagerUtils.cpp b/mozilla/xpcom/glue/nsComponentManagerUtils.cpp index 3be62fc86a1..42ffafa7d0f 100644 --- a/mozilla/xpcom/glue/nsComponentManagerUtils.cpp +++ b/mozilla/xpcom/glue/nsComponentManagerUtils.cpp @@ -150,8 +150,10 @@ nsresult nsGetServiceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const { nsresult status = NS_ERROR_FAILURE; - if ( mServiceManager ) { - status = mServiceManager->GetService(mCID, aIID, (void**)aInstancePtr); + nsCOMPtr serviceManager = + do_QueryInterface(mServiceManager); + if ( serviceManager ) { + status = serviceManager->GetService(mCID, aIID, (void**)aInstancePtr); } else { nsCOMPtr mgr; NS_GetServiceManager(getter_AddRefs(mgr)); @@ -170,8 +172,10 @@ nsresult nsGetServiceByContractID::operator()( const nsIID& aIID, void** aInstancePtr ) const { nsresult status = NS_ERROR_FAILURE; - if ( mServiceManager ) { - status = mServiceManager->GetServiceByContractID(mContractID, aIID, (void**)aInstancePtr); + nsCOMPtr serviceManager = + do_QueryInterface(mServiceManager); + if ( serviceManager ) { + status = serviceManager->GetServiceByContractID(mContractID, aIID, (void**)aInstancePtr); } else { nsCOMPtr mgr; NS_GetServiceManager(getter_AddRefs(mgr)); diff --git a/mozilla/xpcom/glue/nsServiceManagerUtils.h b/mozilla/xpcom/glue/nsServiceManagerUtils.h index b225b6a2e8d..5e3ac6885b0 100644 --- a/mozilla/xpcom/glue/nsServiceManagerUtils.h +++ b/mozilla/xpcom/glue/nsServiceManagerUtils.h @@ -49,7 +49,7 @@ class NS_COM nsGetServiceByCID : public nsCOMPtr_helper public: nsGetServiceByCID( const nsCID& aCID, nsISupports* aServiceManager, nsresult* aErrorPtr ) : mCID(aCID), - mServiceManager( do_QueryInterface(aServiceManager) ), + mServiceManager(aServiceManager), mErrorPtr(aErrorPtr) { // nothing else to do @@ -59,7 +59,7 @@ class NS_COM nsGetServiceByCID : public nsCOMPtr_helper private: const nsCID& mCID; - nsCOMPtr mServiceManager; + nsISupports* mServiceManager; nsresult* mErrorPtr; }; @@ -82,7 +82,7 @@ class NS_COM nsGetServiceByContractID : public nsCOMPtr_helper public: nsGetServiceByContractID( const char* aContractID, nsISupports* aServiceManager, nsresult* aErrorPtr ) : mContractID(aContractID), - mServiceManager( do_QueryInterface(aServiceManager) ), + mServiceManager(aServiceManager), mErrorPtr(aErrorPtr) { // nothing else to do @@ -92,7 +92,7 @@ class NS_COM nsGetServiceByContractID : public nsCOMPtr_helper private: const char* mContractID; - nsCOMPtr mServiceManager; + nsISupports* mServiceManager; nsresult* mErrorPtr; }; @@ -118,7 +118,7 @@ class nsGetServiceFromCategory : public nsCOMPtr_helper nsresult* aErrorPtr) : mCategory(aCategory), mEntry(aEntry), - mServiceManager( do_QueryInterface(aServiceManager) ), + mServiceManager(aServiceManager), mErrorPtr(aErrorPtr) { // nothing else to do @@ -128,7 +128,7 @@ class nsGetServiceFromCategory : public nsCOMPtr_helper protected: const char* mCategory; const char* mEntry; - nsCOMPtr mServiceManager; + nsISupports* mServiceManager; nsresult* mErrorPtr; };