nsIComponentManager API Changes (bug 98553)
a) create a new nsIComponentManager with only four functions on it: CreateInstance CreateInstanceByContractID GetClassInfo GetClassInfoByContractID. b) rename the old nsIComponentManager to nsIComponentManagerObsolete. c) fixes callers which use to access the nsIComponentManager for component registration functionality. These callers will temporary use the nsIComponentManagerObsolete interface. d) Create a new API NS_GetComponentManager() which mirrors the NS_GetServiceManager() e) Perserves the old NS_GetGlobalComponentManager(). Note the cast usage. r/sr = rpotts@netscape.com alecf@netscape.com brendan@mozilla.org git-svn-id: svn://10.0.0.236/trunk@110748 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -815,9 +815,13 @@ mozJSComponentLoader::AttemptRegistration(nsIFile *component,
|
||||
nsXPIDLCString registryLocation;
|
||||
nsresult rv;
|
||||
nsIModule *module;
|
||||
|
||||
rv = mCompMgr->RegistryLocationForSpec(component,
|
||||
getter_Copies(registryLocation));
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->RegistryLocationForSpec(component,
|
||||
getter_Copies(registryLocation));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@@ -886,9 +890,13 @@ mozJSComponentLoader::UnregisterComponent(nsIFile *component)
|
||||
nsXPIDLCString registryLocation;
|
||||
nsresult rv;
|
||||
nsIModule *module;
|
||||
|
||||
rv = mCompMgr->RegistryLocationForSpec(component,
|
||||
getter_Copies(registryLocation));
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->RegistryLocationForSpec(component,
|
||||
getter_Copies(registryLocation));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@@ -1130,8 +1138,13 @@ mozJSComponentLoader::GlobalForLocation(const char *aLocation,
|
||||
}
|
||||
|
||||
if (!component) {
|
||||
if (NS_FAILED(mCompMgr->SpecForRegistryLocation(aLocation,
|
||||
&component)))
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
return nsnull;
|
||||
|
||||
if (NS_FAILED(obsoleteManager->SpecForRegistryLocation(aLocation, &component)))
|
||||
return nsnull;
|
||||
needRelease = PR_TRUE;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
static void SetupRegistry()
|
||||
{
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, nsnull);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, nsnull);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
@@ -369,8 +369,8 @@ nsXPCComponents_Classes::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
{
|
||||
case JSENUMERATE_INIT:
|
||||
{
|
||||
nsIComponentManager* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager(&compMgr)) ||
|
||||
nsIComponentManagerObsolete* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager((nsIComponentManager**)&compMgr)) ||
|
||||
!compMgr || NS_FAILED(compMgr->EnumerateContractIDs(&e)) || !e ||
|
||||
NS_FAILED(e->First()))
|
||||
|
||||
@@ -529,8 +529,8 @@ nsXPCComponents_ClassesByID::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
{
|
||||
case JSENUMERATE_INIT:
|
||||
{
|
||||
nsIComponentManager* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager(&compMgr)) ||
|
||||
nsIComponentManagerObsolete* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager((nsIComponentManager**)&compMgr)) ||
|
||||
!compMgr || NS_FAILED(compMgr->EnumerateCLSIDs(&e)) || !e ||
|
||||
NS_FAILED(e->First()))
|
||||
|
||||
@@ -590,8 +590,8 @@ IsRegisteredCLSID(const char* str)
|
||||
if(!id.Parse(str))
|
||||
return PR_FALSE;
|
||||
|
||||
nsIComponentManager* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager(&compMgr)) ||
|
||||
nsIComponentManagerObsolete* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager((nsIComponentManager**)&compMgr)) ||
|
||||
!compMgr || NS_FAILED(compMgr->IsRegistered(id, ®istered)))
|
||||
return PR_FALSE;
|
||||
|
||||
@@ -1612,17 +1612,7 @@ NS_IMETHODIMP
|
||||
nsXPCComponents::GetManager(nsIComponentManager * *aManager)
|
||||
{
|
||||
NS_ASSERTION(aManager, "bad param");
|
||||
|
||||
nsIComponentManager* cm;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager(&cm)))
|
||||
{
|
||||
*aManager = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_IF_ADDREF(cm);
|
||||
*aManager = cm;
|
||||
|
||||
return NS_OK;
|
||||
return NS_GetComponentManager(aManager);
|
||||
}
|
||||
|
||||
/**********************************************/
|
||||
|
||||
@@ -1109,8 +1109,8 @@ XPCConvert::JSValToXPCException(XPCCallContext& ccx,
|
||||
else
|
||||
{
|
||||
nsISupportsDouble* data;
|
||||
nsIComponentManager* cm;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager(&cm)) || !cm ||
|
||||
nsCOMPtr<nsIComponentManager> cm;
|
||||
if(NS_FAILED(NS_GetComponentManager(getter_AddRefs(cm))) || !cm ||
|
||||
NS_FAILED(cm->CreateInstanceByContractID(
|
||||
NS_SUPPORTS_DOUBLE_CONTRACTID,
|
||||
nsnull,
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
static void SetupRegistry()
|
||||
{
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, nsnull);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, nsnull);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user