mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 14:15:30 +00:00
Move the code to register the app core into the app cores manager from the constructor of the app core into the init function of the app core. Why? nsIAppCoresManager::Add requires that the app core have an id. The id doesn't get assigned until the app core gets initialized. a=mcmullen, rod spears
This commit is contained in:
parent
ba5e47c7e7
commit
1ab8289421
@ -48,23 +48,6 @@ nsBaseAppCore::nsBaseAppCore()
|
||||
{
|
||||
IncInstanceCount();
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
printf("Adding app core to AppCoreManager in the base constructor.\n");
|
||||
#endif
|
||||
nsIDOMAppCoresManager * appCoreManager;
|
||||
nsresult rv = nsServiceManager::GetService(
|
||||
kAppCoresManagerCID,
|
||||
kIDOMAppCoresManagerIID,
|
||||
(nsISupports**)&appCoreManager);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
rv = appCoreManager->Add((nsIDOMBaseAppCore *)this);
|
||||
#ifdef NS_DEBUG
|
||||
if (NS_FAILED(rv))
|
||||
printf("...failed!\n");
|
||||
#endif
|
||||
nsServiceManager::ReleaseService(kAppCoresManagerCID, appCoreManager);
|
||||
}
|
||||
|
||||
nsBaseAppCore::~nsBaseAppCore()
|
||||
@ -127,6 +110,27 @@ NS_IMETHODIMP
|
||||
nsBaseAppCore::Init(const nsString& aId)
|
||||
{
|
||||
mId = aId;
|
||||
|
||||
// this used to be in the constructor of the base class, but
|
||||
// nsIAppCoreManager::Add requires that the app core being added
|
||||
// has a id. So we can't do it until the app core has been initialized
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
printf("Adding app core to AppCoreManager in the base initialization.\n");
|
||||
#endif
|
||||
nsIDOMAppCoresManager * appCoreManager;
|
||||
nsresult rv = nsServiceManager::GetService(
|
||||
kAppCoresManagerCID,
|
||||
kIDOMAppCoresManagerIID,
|
||||
(nsISupports**)&appCoreManager);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = appCoreManager->Add((nsIDOMBaseAppCore *)this);
|
||||
#ifdef NS_DEBUG
|
||||
if (NS_FAILED(rv))
|
||||
printf("...failed!\n");
|
||||
#endif
|
||||
nsServiceManager::ReleaseService(kAppCoresManagerCID, appCoreManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user