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.