зеркало из https://github.com/mozilla/pjs.git
backing out
This commit is contained in:
Родитель
c502ac0a84
Коммит
2dcce96813
|
@ -37,8 +37,6 @@ CPPSRCS = \
|
|||
nsEmbedAPI.cpp \
|
||||
$(NULL)
|
||||
|
||||
SHARED_LIBRARY_LIBS = $(DIST)/lib/libxpfelocation_s.$(LIB_SUFFIX)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
override NO_SHARED_LIB=1
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsAppFileLocationProvider.h"
|
||||
|
||||
#include "nsEmbedAPI.h"
|
||||
|
||||
static nsIServiceManager *sServiceManager = nsnull;
|
||||
|
@ -69,11 +66,24 @@ static XPCOMCleanupHack sXPCOMCleanupHack;
|
|||
extern "C" void NS_SetupRegistry();
|
||||
|
||||
|
||||
nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
|
||||
nsIDirectoryServiceProvider *appFileLocProvider)
|
||||
nsresult NS_InitEmbedding(const char *aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
// Create an object to represent the path
|
||||
nsILocalFile *localFile = nsnull;
|
||||
if (aPath && strlen(aPath) > 0)
|
||||
{
|
||||
NS_NewLocalFile(aPath, PR_FALSE, &localFile);
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -86,32 +96,19 @@ nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
|
|||
#endif
|
||||
{
|
||||
// Initialise XPCOM
|
||||
NS_InitXPCOM(&sServiceManager, mozBinDirectory);
|
||||
NS_InitXPCOM(&sServiceManager, aPath);
|
||||
|
||||
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 (rv != 1) // This is needed but WRONG. RegisterProvider returns TRUE is suceeded, should return NS_OK
|
||||
return NS_ERROR_FAILURE;
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -26,20 +26,9 @@
|
|||
#define NSEMBEDAPI_H
|
||||
|
||||
#include "nsILocalFile.h"
|
||||
class nsIDirectoryServiceProvider;
|
||||
|
||||
|
||||
/*
|
||||
mozBinDirectory -> the directory which contains the mozilla parts (chrome, res, etc)
|
||||
If nsnull is used, the dir of the current process will be used.
|
||||
appFileLocProvider -> Provides file locations. If nsnull is passed, the default
|
||||
provider will be constructed and used. If the param is non-null,
|
||||
it must be AddRefed already and this function takes ownership.
|
||||
*/
|
||||
|
||||
extern nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
|
||||
nsIDirectoryServiceProvider *appFileLocProvider);
|
||||
|
||||
extern nsresult NS_InitEmbedding(const char *aPath);
|
||||
extern nsresult NS_InitEmbedding(nsILocalFile *aPath);
|
||||
extern nsresult NS_TermEmbedding();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -728,14 +728,12 @@ HRESULT CMozillaBrowser::Initialize()
|
|||
// Create an object to represent the path
|
||||
if (_tcslen(szBinDirPath) > 0)
|
||||
{
|
||||
nsCOMPtr<nsILocalFile> binDir;
|
||||
USES_CONVERSION;
|
||||
nsresult res = NS_NewLocalFile(T2A(szBinDirPath), TRUE, getter_AddRefs(binDir));
|
||||
res = NS_InitEmbedding(binDir, nsnull);
|
||||
nsresult res = NS_InitEmbedding(T2A(szBinDirPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_InitEmbedding(nsnull, nsnull);
|
||||
NS_InitEmbedding((const char *) nsnull);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -85,7 +85,6 @@ OBJS = \
|
|||
LLIBS= \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\baseembed_s.lib \
|
||||
$(DIST)\lib\appfilelocprovider_s.lib \
|
||||
$(LIBNSPR) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ handle_event_queue(gpointer data, gint source, GdkInputCondition condition)
|
|||
char *argv[] )
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsILocalFile> binDir;
|
||||
NS_InitEmbedding(binDir, nsnull);
|
||||
NS_InitEmbedding("");
|
||||
|
||||
// set up the thread event queue
|
||||
nsIEventQueueService* eventQService;
|
||||
|
|
|
@ -37,7 +37,6 @@ LLIBS= \
|
|||
$(DIST)\lib\baseembed_s.lib \
|
||||
$(DIST)\lib\gkgfxwin.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\appfilelocprovider_s.lib \
|
||||
$(LIBNSPR) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ int main ()
|
|||
MyRegisterClass(hInstance);
|
||||
|
||||
// Init Embedding APIs
|
||||
NS_InitEmbedding(nsnull, nsnull);
|
||||
NS_InitEmbedding("");
|
||||
|
||||
// put up at lease on browser window ....
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
|
Загрузка…
Ссылка в новой задаче