Fix for #149208 - NS_InitEmbedding() uncoditionally calls AutoRegister

[When this fix was originally checked in, it broke registration of
components in the MRE dir. This patch fixes it]
r=darin, sr=bryner
This commit is contained in:
chak%netscape.com 2002-08-22 23:04:04 +00:00
parent 456023baa0
commit c90e682531

View File

@ -523,6 +523,31 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
// if we find no persistent registry, we will try to autoregister
// the default components directory.
nsComponentManagerImpl::gComponentManager->AutoRegister(nsnull);
// If the application is using an MRE, then,
// auto register components in the MRE directory as well.
//
// The application indicates that it's using an MRE by
// returning a valid nsIFile when queried (via appFileLocProvider)
// for the NS_MRE_DIR atom as shown below
//
if ( appFileLocationProvider ) {
nsCOMPtr<nsIFile> mreDir;
PRBool persistent = PR_TRUE;
appFileLocationProvider->GetFile(NS_MRE_DIR, &persistent, getter_AddRefs(mreDir));
if (mreDir)
{
rv = nsComponentManagerImpl::gComponentManager->AutoRegister(mreDir);
if (NS_FAILED(rv))
{
NS_ERROR("Could not AutoRegister MRE components");
return rv;
}
}
}
}
// Pay the cost at startup time of starting this singleton.