зеркало из https://github.com/mozilla/pjs.git
1. Removed NS_Init which took a path.
This commit is contained in:
Родитель
9b674df6c3
Коммит
bc10d4058f
|
@ -28,6 +28,9 @@
|
|||
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsAppFileLocationProvider.h"
|
||||
|
||||
#include "nsEmbedAPI.h"
|
||||
|
||||
static nsIServiceManager *sServiceManager = nsnull;
|
||||
|
@ -66,24 +69,11 @@ static XPCOMCleanupHack sXPCOMCleanupHack;
|
|||
extern "C" void NS_SetupRegistry();
|
||||
|
||||
|
||||
nsresult NS_InitEmbedding(const char *aPath)
|
||||
nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
|
||||
nsIDirectoryServiceProvider *appFileLocProvider)
|
||||
{
|
||||
// Create an object to represent the path
|
||||
nsILocalFile *localFile = nsnull;
|
||||
if (aPath && strlen(aPath) > 0)
|
||||
{
|
||||
NS_NewLocalFile(aPath, PR_FALSE, &localFile);
|
||||
}
|
||||
nsresult rv;
|
||||
|
||||
nsresult rv = NS_InitEmbedding(localFile);
|
||||
NS_IF_RELEASE(localFile);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult NS_InitEmbedding(nsILocalFile *aPath)
|
||||
{
|
||||
// Reentrant calls to this method do nothing except increment a counter
|
||||
sInitCounter++;
|
||||
if (sInitCounter > 1)
|
||||
|
@ -96,19 +86,32 @@ nsresult NS_InitEmbedding(nsILocalFile *aPath)
|
|||
#endif
|
||||
{
|
||||
// Initialise XPCOM
|
||||
NS_InitXPCOM(&sServiceManager, aPath);
|
||||
|
||||
NS_InitXPCOM(&sServiceManager, mozBinDirectory);
|
||||
if (!sServiceManager)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Hook up the file location provider - make one if nsnull was passed
|
||||
if (!appFileLocProvider)
|
||||
{
|
||||
appFileLocProvider = new nsAppFileLocationProvider;
|
||||
if (!appFileLocProvider)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(appFileLocProvider);
|
||||
}
|
||||
NS_WITH_SERVICE(nsIDirectoryService, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = directoryService->RegisterProvider(appFileLocProvider);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
NS_RELEASE(appFileLocProvider); // RegisterProvider did AddRef - It owns it now
|
||||
|
||||
#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM
|
||||
sXPCOMInitializedFlag = PR_TRUE;
|
||||
sXPCOMCleanupHack.mCleanOnExit = PR_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// Register components
|
||||
if (!sRegistryInitializedFlag)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче