diff --git a/embedding/base/Makefile.in b/embedding/base/Makefile.in index 2aaa6f94529..fc864831549 100644 --- a/embedding/base/Makefile.in +++ b/embedding/base/Makefile.in @@ -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 diff --git a/embedding/base/nsEmbedAPI.cpp b/embedding/base/nsEmbedAPI.cpp index d4f0bc287c7..d6bdecb8fbe 100644 --- a/embedding/base/nsEmbedAPI.cpp +++ b/embedding/base/nsEmbedAPI.cpp @@ -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) { diff --git a/embedding/base/nsEmbedAPI.h b/embedding/base/nsEmbedAPI.h index d0acef3801c..aeed59898cc 100644 --- a/embedding/base/nsEmbedAPI.h +++ b/embedding/base/nsEmbedAPI.h @@ -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 diff --git a/embedding/browser/activex/src/control/MozillaBrowser.cpp b/embedding/browser/activex/src/control/MozillaBrowser.cpp index 9d13a7109fb..e6b80ceed6a 100644 --- a/embedding/browser/activex/src/control/MozillaBrowser.cpp +++ b/embedding/browser/activex/src/control/MozillaBrowser.cpp @@ -728,14 +728,12 @@ HRESULT CMozillaBrowser::Initialize() // Create an object to represent the path if (_tcslen(szBinDirPath) > 0) { - nsCOMPtr 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; diff --git a/embedding/browser/activex/src/control/makefile.win b/embedding/browser/activex/src/control/makefile.win index 54809475d04..5557278b2ff 100644 --- a/embedding/browser/activex/src/control/makefile.win +++ b/embedding/browser/activex/src/control/makefile.win @@ -85,7 +85,6 @@ OBJS = \ LLIBS= \ $(DIST)\lib\xpcom.lib \ $(DIST)\lib\baseembed_s.lib \ - $(DIST)\lib\appfilelocprovider_s.lib \ $(LIBNSPR) \ $(NULL) diff --git a/embedding/tests/gtkEmbed/main.cpp b/embedding/tests/gtkEmbed/main.cpp index 214cfaeec39..bd8651b0de4 100644 --- a/embedding/tests/gtkEmbed/main.cpp +++ b/embedding/tests/gtkEmbed/main.cpp @@ -27,8 +27,7 @@ handle_event_queue(gpointer data, gint source, GdkInputCondition condition) char *argv[] ) { nsresult rv; - nsCOMPtr binDir; - NS_InitEmbedding(binDir, nsnull); + NS_InitEmbedding(""); // set up the thread event queue nsIEventQueueService* eventQService; diff --git a/embedding/tests/winEmbed/makefile.win b/embedding/tests/winEmbed/makefile.win index bb2c122261f..7bc1b75972f 100644 --- a/embedding/tests/winEmbed/makefile.win +++ b/embedding/tests/winEmbed/makefile.win @@ -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) diff --git a/embedding/tests/winEmbed/winEmbed.cpp b/embedding/tests/winEmbed/winEmbed.cpp index 4d89cd9bdac..240480eb2e2 100644 --- a/embedding/tests/winEmbed/winEmbed.cpp +++ b/embedding/tests/winEmbed/winEmbed.cpp @@ -113,7 +113,7 @@ int main () MyRegisterClass(hInstance); // Init Embedding APIs - NS_InitEmbedding(nsnull, nsnull); + NS_InitEmbedding(""); // put up at lease on browser window .... /////////////////////////////////////////////////////////////