From 115d1eadb1311c2054ec9f06390a7a9db6279bcc Mon Sep 17 00:00:00 2001 From: "chak%netscape.com" Date: Thu, 22 Aug 2002 23:04:04 +0000 Subject: [PATCH] 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 git-svn-id: svn://10.0.0.236/trunk@127902 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/build/nsXPComInit.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/mozilla/xpcom/build/nsXPComInit.cpp b/mozilla/xpcom/build/nsXPComInit.cpp index 83ee3cb88a6..7449ff96eaa 100644 --- a/mozilla/xpcom/build/nsXPComInit.cpp +++ b/mozilla/xpcom/build/nsXPComInit.cpp @@ -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 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.