diff --git a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp index d6b63e0b0db..6f509cfa067 100644 --- a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp +++ b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp @@ -54,8 +54,7 @@ static const tstring c_szHelpKey = _T("Software\\Microsoft\\Windows\\CurrentVers #define MOZ_CONTROL_REG_KEY _T("Software\\Mozilla\\") #define MOZ_CONTROL_REG_VALUE_DIR _T("Dir") -#define MOZ_CONTROL_REG_VALUE_COMPONENT_PATH _T("ComponentPath") -#define MOZ_CONTROL_REG_VALUE_COMPONENT_FILE _T("ComponentFile") +#define MOZ_CONTROL_REG_VALUE_BIN_DIRECTORY_PATH _T("BinDirectoryPath") BOOL CMozillaBrowser::m_bRegistryInitialized = FALSE; @@ -107,8 +106,7 @@ CMozillaBrowser::CMozillaBrowser() m_UserKey.Create(HKEY_CURRENT_USER, MOZ_CONTROL_REG_KEY); // Component path and file - m_pComponentPath = NULL; - m_pComponentFile = NULL; + m_pBinDirPath = NULL; // Initialise the web shell InitWebShell(); @@ -566,26 +564,21 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); HRESULT CMozillaBrowser::InitWebShell() { // Initialise XPCOM - TCHAR szComponentPath[MAX_PATH]; - TCHAR szComponentFile[MAX_PATH]; - DWORD dwComponentPath = sizeof(szComponentPath) / sizeof(szComponentPath[0]); - DWORD dwComponentFile = sizeof(szComponentFile) / sizeof(szComponentFile[0]); + TCHAR szBinDirPath[MAX_PATH]; + DWORD dwBinDirPath = sizeof(szBinDirPath) / sizeof(szBinDirPath[0]); - memset(szComponentPath, 0, sizeof(szComponentPath)); - memset(szComponentFile, 0, sizeof(szComponentFile)); - if (m_SystemKey.QueryValue(szComponentPath, MOZ_CONTROL_REG_VALUE_COMPONENT_PATH, &dwComponentPath) == ERROR_SUCCESS && - m_SystemKey.QueryValue(szComponentFile, MOZ_CONTROL_REG_VALUE_COMPONENT_FILE, &dwComponentFile) == ERROR_SUCCESS) + memset(szBinDirPath, 0, sizeof(szBinDirPath)); + if (m_SystemKey.QueryValue(szBinDirPath, MOZ_CONTROL_REG_VALUE_BIN_DIRECTORY_PATH, &dwBinDirPath) == ERROR_SUCCESS) { USES_CONVERSION; - m_pComponentPath = new nsFileSpec(T2A(szComponentPath)); - m_pComponentFile = new nsFileSpec(T2A(szComponentFile)); + m_pBinDirPath = new nsFileSpec(T2A(szBinDirPath)); - NS_InitXPCOM(&m_pIServiceManager, m_pComponentFile, m_pComponentPath); + NS_InitXPCOM(&m_pIServiceManager, m_pBinDirPath); } else { - NS_InitXPCOM(&m_pIServiceManager, nsnull, nsnull); + NS_InitXPCOM(&m_pIServiceManager, nsnull); } // Register components @@ -622,15 +615,10 @@ HRESULT CMozillaBrowser::TermWebShell() NS_ShutdownXPCOM(m_pIServiceManager); m_pIServiceManager = nsnull; - if (m_pComponentPath) + if (m_pBinDirPath) { - delete m_pComponentPath; - m_pComponentPath = NULL; - } - if (m_pComponentFile) - { - delete m_pComponentFile; - m_pComponentFile = NULL; + delete m_pBinDirPath; + m_pBinDirPath = NULL; } return S_OK; @@ -2790,4 +2778,4 @@ HRESULT _stdcall CMozillaBrowser::EditCommandHandler(CMozillaBrowser *pThis, con { pThis->OnEditorCommand(nCmdID); return S_OK; -} \ No newline at end of file +} diff --git a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h index 26887005787..53b97d7522c 100644 --- a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h +++ b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h @@ -326,10 +326,8 @@ protected: // List of registered browser helper objects ObjectList m_cBrowserHelperList; - // Pointer to the component folder - nsFileSpec *m_pComponentPath; - // Pointer to the component file - nsFileSpec *m_pComponentFile; + // Pointer to the bin directory + nsFileSpec *m_pBinDirPath; virtual HRESULT CreateWebShell(); virtual HRESULT InitWebShell(); diff --git a/mozilla/js/src/xpconnect/shell/xpcshell.cpp b/mozilla/js/src/xpconnect/shell/xpcshell.cpp index c2575fe634a..513c407bfd2 100644 --- a/mozilla/js/src/xpconnect/shell/xpcshell.cpp +++ b/mozilla/js/src/xpconnect/shell/xpcshell.cpp @@ -643,7 +643,7 @@ main(int argc, char **argv) gErrFile = stderr; gOutFile = stdout; - rv = NS_InitXPCOM(NULL, NULL, NULL); + rv = NS_InitXPCOM(NULL, NULL); NS_ASSERTION( NS_SUCCEEDED(rv), "NS_InitXPCOM failed" ); SetupRegistry(); diff --git a/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.cpp b/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.cpp index f9abb073c4e..b9804409589 100644 --- a/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.cpp +++ b/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.cpp @@ -58,11 +58,11 @@ nsResProtocolHandler::Init() return NS_ERROR_OUT_OF_MEMORY; // set up initial mappings - rv = SetSpecialDir("ProgramDir", nsSpecialSystemDirectory::OS_CurrentProcessDirectory); + rv = SetSpecialDir("ProgramDir", nsSpecialSystemDirectory::Moz_BinDirectory); if (NS_FAILED(rv)) return rv; // make "res:///" == "resource:/" - rv = SetSpecialDir("", nsSpecialSystemDirectory::OS_CurrentProcessDirectory); + rv = SetSpecialDir("", nsSpecialSystemDirectory::Moz_BinDirectory); if (NS_FAILED(rv)) return rv; rv = SetSpecialDir("CurrentDir", nsSpecialSystemDirectory::OS_CurrentWorkingDirectory); diff --git a/mozilla/webshell/embed/ActiveX/MozillaBrowser.cpp b/mozilla/webshell/embed/ActiveX/MozillaBrowser.cpp index d6b63e0b0db..6f509cfa067 100644 --- a/mozilla/webshell/embed/ActiveX/MozillaBrowser.cpp +++ b/mozilla/webshell/embed/ActiveX/MozillaBrowser.cpp @@ -54,8 +54,7 @@ static const tstring c_szHelpKey = _T("Software\\Microsoft\\Windows\\CurrentVers #define MOZ_CONTROL_REG_KEY _T("Software\\Mozilla\\") #define MOZ_CONTROL_REG_VALUE_DIR _T("Dir") -#define MOZ_CONTROL_REG_VALUE_COMPONENT_PATH _T("ComponentPath") -#define MOZ_CONTROL_REG_VALUE_COMPONENT_FILE _T("ComponentFile") +#define MOZ_CONTROL_REG_VALUE_BIN_DIRECTORY_PATH _T("BinDirectoryPath") BOOL CMozillaBrowser::m_bRegistryInitialized = FALSE; @@ -107,8 +106,7 @@ CMozillaBrowser::CMozillaBrowser() m_UserKey.Create(HKEY_CURRENT_USER, MOZ_CONTROL_REG_KEY); // Component path and file - m_pComponentPath = NULL; - m_pComponentFile = NULL; + m_pBinDirPath = NULL; // Initialise the web shell InitWebShell(); @@ -566,26 +564,21 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); HRESULT CMozillaBrowser::InitWebShell() { // Initialise XPCOM - TCHAR szComponentPath[MAX_PATH]; - TCHAR szComponentFile[MAX_PATH]; - DWORD dwComponentPath = sizeof(szComponentPath) / sizeof(szComponentPath[0]); - DWORD dwComponentFile = sizeof(szComponentFile) / sizeof(szComponentFile[0]); + TCHAR szBinDirPath[MAX_PATH]; + DWORD dwBinDirPath = sizeof(szBinDirPath) / sizeof(szBinDirPath[0]); - memset(szComponentPath, 0, sizeof(szComponentPath)); - memset(szComponentFile, 0, sizeof(szComponentFile)); - if (m_SystemKey.QueryValue(szComponentPath, MOZ_CONTROL_REG_VALUE_COMPONENT_PATH, &dwComponentPath) == ERROR_SUCCESS && - m_SystemKey.QueryValue(szComponentFile, MOZ_CONTROL_REG_VALUE_COMPONENT_FILE, &dwComponentFile) == ERROR_SUCCESS) + memset(szBinDirPath, 0, sizeof(szBinDirPath)); + if (m_SystemKey.QueryValue(szBinDirPath, MOZ_CONTROL_REG_VALUE_BIN_DIRECTORY_PATH, &dwBinDirPath) == ERROR_SUCCESS) { USES_CONVERSION; - m_pComponentPath = new nsFileSpec(T2A(szComponentPath)); - m_pComponentFile = new nsFileSpec(T2A(szComponentFile)); + m_pBinDirPath = new nsFileSpec(T2A(szBinDirPath)); - NS_InitXPCOM(&m_pIServiceManager, m_pComponentFile, m_pComponentPath); + NS_InitXPCOM(&m_pIServiceManager, m_pBinDirPath); } else { - NS_InitXPCOM(&m_pIServiceManager, nsnull, nsnull); + NS_InitXPCOM(&m_pIServiceManager, nsnull); } // Register components @@ -622,15 +615,10 @@ HRESULT CMozillaBrowser::TermWebShell() NS_ShutdownXPCOM(m_pIServiceManager); m_pIServiceManager = nsnull; - if (m_pComponentPath) + if (m_pBinDirPath) { - delete m_pComponentPath; - m_pComponentPath = NULL; - } - if (m_pComponentFile) - { - delete m_pComponentFile; - m_pComponentFile = NULL; + delete m_pBinDirPath; + m_pBinDirPath = NULL; } return S_OK; @@ -2790,4 +2778,4 @@ HRESULT _stdcall CMozillaBrowser::EditCommandHandler(CMozillaBrowser *pThis, con { pThis->OnEditorCommand(nCmdID); return S_OK; -} \ No newline at end of file +} diff --git a/mozilla/webshell/embed/ActiveX/MozillaBrowser.h b/mozilla/webshell/embed/ActiveX/MozillaBrowser.h index 26887005787..53b97d7522c 100644 --- a/mozilla/webshell/embed/ActiveX/MozillaBrowser.h +++ b/mozilla/webshell/embed/ActiveX/MozillaBrowser.h @@ -326,10 +326,8 @@ protected: // List of registered browser helper objects ObjectList m_cBrowserHelperList; - // Pointer to the component folder - nsFileSpec *m_pComponentPath; - // Pointer to the component file - nsFileSpec *m_pComponentFile; + // Pointer to the bin directory + nsFileSpec *m_pBinDirPath; virtual HRESULT CreateWebShell(); virtual HRESULT InitWebShell(); diff --git a/mozilla/webshell/tests/viewer/nsMacMain.cpp b/mozilla/webshell/tests/viewer/nsMacMain.cpp index 10c92a81a3f..57a8de20de6 100644 --- a/mozilla/webshell/tests/viewer/nsMacMain.cpp +++ b/mozilla/webshell/tests/viewer/nsMacMain.cpp @@ -394,7 +394,7 @@ int main(int argc, char **argv) NS_ASSERTION((err==noErr), "AEInstallEventHandler failed"); // Start up XPCOM? - nsresult rv = NS_InitXPCOM(nsnull, nsnull, nsnull); + nsresult rv = NS_InitXPCOM(nsnull, nsnull); NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed"); // Hack to get il_ss set so it doesn't fail in xpcompat.c diff --git a/mozilla/webshell/tests/viewer/nsPhMain.cpp b/mozilla/webshell/tests/viewer/nsPhMain.cpp index b7b8013d3e4..4989285bbe5 100644 --- a/mozilla/webshell/tests/viewer/nsPhMain.cpp +++ b/mozilla/webshell/tests/viewer/nsPhMain.cpp @@ -170,7 +170,7 @@ int main(int argc, char **argv) signal(SIGABRT, abnormal_exit_handler); // Initialize XPCOM - nsresult rv = NS_InitXPCOM(nsnull, nsnull, nsnull); + nsresult rv = NS_InitXPCOM(nsnull, nsnull); NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed"); if (NS_SUCCEEDED(rv)) { // The toolkit service in mozilla will look in the environment diff --git a/mozilla/webshell/tests/viewer/nsWinMain.cpp b/mozilla/webshell/tests/viewer/nsWinMain.cpp index 4af7fecf5b3..454928f24c1 100644 --- a/mozilla/webshell/tests/viewer/nsWinMain.cpp +++ b/mozilla/webshell/tests/viewer/nsWinMain.cpp @@ -129,7 +129,7 @@ nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID) int main(int argc, char **argv) { nsresult rv; - rv = NS_InitXPCOM(nsnull, nsnull, nsnull); + rv = NS_InitXPCOM(nsnull, nsnull); NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed"); nsViewerApp* app = new nsNativeViewerApp(); NS_ADDREF(app); diff --git a/mozilla/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp b/mozilla/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp index 32c8cbd5d0c..8490e0b3aa4 100644 --- a/mozilla/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp +++ b/mozilla/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp @@ -152,7 +152,7 @@ int main(int argc, char **argv) #endif // CRAWL_STACK_ON_SIGSEGV // Initialize XPCOM - nsresult rv = NS_InitXPCOM(nsnull, nsnull, nsnull); + nsresult rv = NS_InitXPCOM(nsnull, nsnull); NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed"); if (NS_SUCCEEDED(rv)) { // The toolkit service in mozilla will look in the environment diff --git a/mozilla/xpcom/build/nsXPComInit.cpp b/mozilla/xpcom/build/nsXPComInit.cpp index 6d131264adc..ed79534c90e 100644 --- a/mozilla/xpcom/build/nsXPComInit.cpp +++ b/mozilla/xpcom/build/nsXPComInit.cpp @@ -172,7 +172,7 @@ extern nsIServiceManager* gServiceManager; extern PRBool gShuttingDown; nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result, - nsFileSpec *registryFile, nsFileSpec *componentDir) + nsFileSpec *binDirectory) { nsresult rv = NS_OK; @@ -205,15 +205,10 @@ nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result, NS_ADDREF(compMgr); // Set the registry file - if (registryFile && registryFile->IsFile()) + if (binDirectory && binDirectory->IsDirectory()) { - nsSpecialSystemDirectory::Set(nsSpecialSystemDirectory::XPCOM_CurrentProcessComponentRegistry, - registryFile); - } - if (componentDir && componentDir->IsDirectory()) - { - nsSpecialSystemDirectory::Set(nsSpecialSystemDirectory::XPCOM_CurrentProcessComponentDirectory, - componentDir); + nsSpecialSystemDirectory::Set(nsSpecialSystemDirectory::Moz_BinDirectory, + binDirectory); } rv = compMgr->Init(); if (NS_FAILED(rv)) diff --git a/mozilla/xpcom/components/nsComponentManager.cpp b/mozilla/xpcom/components/nsComponentManager.cpp index 52261d5e133..59aaa02297e 100644 --- a/mozilla/xpcom/components/nsComponentManager.cpp +++ b/mozilla/xpcom/components/nsComponentManager.cpp @@ -2251,7 +2251,7 @@ NS_GetGlobalComponentManager(nsIComponentManager* *result) if (nsComponentManagerImpl::gComponentManager == NULL) { // XPCOM needs initialization. - rv = NS_InitXPCOM(NULL, NULL, NULL); + rv = NS_InitXPCOM(NULL, NULL); } if (NS_SUCCEEDED(rv)) diff --git a/mozilla/xpcom/components/nsIServiceManager.h b/mozilla/xpcom/components/nsIServiceManager.h index 424da815777..a62aadba20e 100644 --- a/mozilla/xpcom/components/nsIServiceManager.h +++ b/mozilla/xpcom/components/nsIServiceManager.h @@ -332,12 +332,12 @@ NS_NewServiceManager(nsIServiceManager* *result); // before any call can be made to XPCOM. Currently we are coping with this // not being called and internally initializing XPCOM if not already. // -// registryFileName is the absolute path to the registry file. This -// file will be checked for existence. If it does not exist, it -// will use the current process directory name, and tack on "component.reg" + +// binDirectory is the absolute path to the mozilla bin directory. +// directory must contain a "components" directory and a component.reg file. extern NS_COM nsresult -NS_InitXPCOM(nsIServiceManager* *result, nsFileSpec* registryFile, nsFileSpec* componentDir); +NS_InitXPCOM(nsIServiceManager* *result, nsFileSpec* binDirectory); extern NS_COM nsresult NS_ShutdownXPCOM(nsIServiceManager* servMgr); diff --git a/mozilla/xpcom/components/nsServiceManager.cpp b/mozilla/xpcom/components/nsServiceManager.cpp index 6d51e6cc673..12e8dcd1f3c 100644 --- a/mozilla/xpcom/components/nsServiceManager.cpp +++ b/mozilla/xpcom/components/nsServiceManager.cpp @@ -473,7 +473,7 @@ nsServiceManager::GetGlobalServiceManager(nsIServiceManager* *result) nsresult rv = NS_OK; if (gServiceManager == NULL) { // XPCOM not initialized yet. Let us do initialization of our module. - rv = NS_InitXPCOM(NULL, NULL, NULL); + rv = NS_InitXPCOM(NULL, NULL); } // No ADDREF as we are advicing no release of this. if (NS_SUCCEEDED(rv)) diff --git a/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp b/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp index c51778147c2..5cc634d40c6 100644 --- a/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp +++ b/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp @@ -294,6 +294,12 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect //---------------------------------------------------------------------------------------- { SystemDirectoriesKey dirKey(aSystemSystemDirectory); + SystemDirectoriesKey mozBinDirKey(Moz_BinDirectory); + + // This flag is used to tell whether or not we need to append something + // onto the *this. Search for needToAppend to how it's used. + // IT's VERY IMPORTANT that needToAppend is initialized to PR_TRUE. + PRBool needToAppend = PR_TRUE; *this = (const char*)nsnull; switch (aSystemSystemDirectory) @@ -353,10 +359,22 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect case XPCOM_CurrentProcessComponentRegistry: { nsFileSpec *dirSpec = NULL; - if (systemDirectoriesLocations) - { - dirSpec = (nsFileSpec *) systemDirectoriesLocations->Get(&dirKey); + + // if someone has called nsSpecialSystemDirectory::Set() + if (systemDirectoriesLocations) { + // look for the value for the argument key + if (!(dirSpec = (nsFileSpec *)systemDirectoriesLocations->Get(&dirKey))) { + // if not found, try Moz_BinDirectory + dirSpec = (nsFileSpec *) + systemDirectoriesLocations->Get(&mozBinDirKey); + } + else { + // if the value is found for the argument key, + // we don't need to append. + needToAppend = PR_FALSE; + } } + if (dirSpec) { *this = *dirSpec; @@ -364,6 +382,9 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect else { GetCurrentProcessDirectory(*this); + } + + if (needToAppend) { // XXX We need to unify these names across all platforms #ifdef XP_MAC *this += "Component Registry"; @@ -377,9 +398,19 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect case XPCOM_CurrentProcessComponentDirectory: { nsFileSpec *dirSpec = NULL; - if (systemDirectoriesLocations) - { - dirSpec = (nsFileSpec *) systemDirectoriesLocations->Get(&dirKey); + // if someone has called nsSpecialSystemDirectory::Set() + if (systemDirectoriesLocations) { + // look for the value for the argument key + if (!(dirSpec = (nsFileSpec *)systemDirectoriesLocations->Get(&dirKey))) { + // if not found, try Moz_BinDirectory + dirSpec = (nsFileSpec *) + systemDirectoriesLocations->Get(&mozBinDirKey); + } + else { + // if the value is found for the argument key, + // we don't need to append. + needToAppend = PR_FALSE; + } } if (dirSpec) { @@ -389,6 +420,9 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect { // /Components GetCurrentProcessDirectory(*this); + } + + if (needToAppend) { // XXX We need to unify these names across all platforms #ifdef XP_MAC *this += "Components"; @@ -399,6 +433,24 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect } break; + case Moz_BinDirectory: + { + nsFileSpec *dirSpec = NULL; + // if someone has called nsSpecialSystemDirectory::Set() + if (systemDirectoriesLocations) { + // look for the value for the argument key + dirSpec = (nsFileSpec *) + systemDirectoriesLocations->Get(&dirKey); + } + if (dirSpec) { + *this = *dirSpec; + } + else { + GetCurrentProcessDirectory(*this); + } + } + break; + #ifdef XP_MAC case Mac_SystemDirectory: *this = kSystemFolderType; @@ -672,27 +724,24 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect } } -// XXX what does this return value mean?! It isn't checked anywhere, -// and a NULL return from the hashtable->Put() isn't an error. -PRBool +void nsSpecialSystemDirectory::Set(SystemDirectories dirToSet, nsFileSpec *dirSpec) { - PRBool rc = PR_FALSE; SystemDirectoriesKey dirKey(dirToSet); PR_ASSERT(NULL != dirSpec); - + if (NULL == systemDirectoriesLocations) { systemDirectoriesLocations = new nsHashtable(NS_SYSTEMDIR_HASH_NUM); } PR_ASSERT(NULL != systemDirectoriesLocations); nsFileSpec *newSpec = new nsFileSpec(*dirSpec); - if (newSpec && NULL != systemDirectoriesLocations->Put(&dirKey, newSpec)) { - rc = PR_TRUE; + if (NULL != newSpec) { + systemDirectoriesLocations->Put(&dirKey, newSpec); } - return rc; + return; } #ifdef XP_MAC diff --git a/mozilla/xpcom/io/nsSpecialSystemDirectory.h b/mozilla/xpcom/io/nsSpecialSystemDirectory.h index dadd16a4733..4fbd7d5fc13 100644 --- a/mozilla/xpcom/io/nsSpecialSystemDirectory.h +++ b/mozilla/xpcom/io/nsSpecialSystemDirectory.h @@ -48,6 +48,8 @@ class NS_COM nsSpecialSystemDirectory : public nsFileSpec , XPCOM_CurrentProcessComponentDirectory= 5 , XPCOM_CurrentProcessComponentRegistry= 6 + + , Moz_BinDirectory = 10 , Mac_SystemDirectory = 101 , Mac_DesktopDirectory = 102 @@ -119,7 +121,7 @@ class NS_COM nsSpecialSystemDirectory : public nsFileSpec */ - static PRBool Set(SystemDirectories dirToSet, nsFileSpec *dirSpec); + static void Set(SystemDirectories dirToSet, nsFileSpec *dirSpec); private: diff --git a/mozilla/xpcom/tests/TestBuffers.cpp b/mozilla/xpcom/tests/TestBuffers.cpp index c0ac0e8b06a..3cf505bb8b0 100644 --- a/mozilla/xpcom/tests/TestBuffers.cpp +++ b/mozilla/xpcom/tests/TestBuffers.cpp @@ -345,7 +345,7 @@ main(int argc, char* argv[]) gVerbose = PR_TRUE; } - rv = NS_InitXPCOM(&servMgr, NULL, NULL); + rv = NS_InitXPCOM(&servMgr, NULL); if (NS_FAILED(rv)) return rv; rv = TestWriteSegments(NS_OK); diff --git a/mozilla/xpcom/tests/TestPipes.cpp b/mozilla/xpcom/tests/TestPipes.cpp index 5d30f0007fe..c80f0ca6208 100644 --- a/mozilla/xpcom/tests/TestPipes.cpp +++ b/mozilla/xpcom/tests/TestPipes.cpp @@ -582,7 +582,7 @@ main(int argc, char* argv[]) nsresult rv; nsIServiceManager* servMgr; - rv = NS_InitXPCOM(&servMgr, NULL, NULL); + rv = NS_InitXPCOM(&servMgr, NULL); if (NS_FAILED(rv)) return rv; if (argc > 1 && nsCRT::strcmp(argv[1], "-trace") == 0) diff --git a/mozilla/xpcom/tests/TestShutdown.cpp b/mozilla/xpcom/tests/TestShutdown.cpp index 4e140772bac..f733f39fce0 100644 --- a/mozilla/xpcom/tests/TestShutdown.cpp +++ b/mozilla/xpcom/tests/TestShutdown.cpp @@ -29,7 +29,7 @@ void main(int argc, char* argv[]) { nsresult rv; nsIServiceManager* servMgr; - rv = NS_InitXPCOM(&servMgr, NULL, NULL); + rv = NS_InitXPCOM(&servMgr, NULL); NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed"); // try loading a component and releasing it to see if it leaks diff --git a/mozilla/xpcom/tests/windows/TestHelloXPLoop.cpp b/mozilla/xpcom/tests/windows/TestHelloXPLoop.cpp index 626e20653a7..e4daee8a86d 100644 --- a/mozilla/xpcom/tests/windows/TestHelloXPLoop.cpp +++ b/mozilla/xpcom/tests/windows/TestHelloXPLoop.cpp @@ -49,7 +49,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prevInstance, LPSTR lpszCmdLine, int retCode; nsresult rv; - rv = NS_InitXPCOM(NULL, NULL, NULL); + rv = NS_InitXPCOM(NULL, NULL); { // Needed to scope all nsCOMPtr within XPCOM Init and Shutdown if(NS_FAILED(rv)) { diff --git a/mozilla/xpcom/tools/registry/regExport.cpp b/mozilla/xpcom/tools/registry/regExport.cpp index 25e3196d0af..c425a35a2ef 100644 --- a/mozilla/xpcom/tools/registry/regExport.cpp +++ b/mozilla/xpcom/tools/registry/regExport.cpp @@ -55,7 +55,7 @@ int main( int argc, char *argv[] ) { // Initialize XPCOM nsIServiceManager *servMgr = NULL; - rv = NS_InitXPCOM(&servMgr, NULL, NULL); + rv = NS_InitXPCOM(&servMgr, NULL); if (NS_FAILED(rv)) { // Cannot initialize XPCOM diff --git a/mozilla/xpcom/tools/registry/regxpcom.cpp b/mozilla/xpcom/tools/registry/regxpcom.cpp index 82a22429f3c..20cc91c41f4 100644 --- a/mozilla/xpcom/tools/registry/regxpcom.cpp +++ b/mozilla/xpcom/tools/registry/regxpcom.cpp @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) { int ret = 0; - NS_InitXPCOM(NULL, NULL, NULL); + NS_InitXPCOM(NULL, NULL); /* With no arguments, RegFactory will autoregister */ if (argc <= 1) diff --git a/mozilla/xpfe/appshell/src/nsFileLocations.cpp b/mozilla/xpfe/appshell/src/nsFileLocations.cpp index 4e62c3ebfd3..c9efcdf3bc4 100644 --- a/mozilla/xpfe/appshell/src/nsFileLocations.cpp +++ b/mozilla/xpfe/appshell/src/nsFileLocations.cpp @@ -215,7 +215,7 @@ static void GetDefaultUserProfileRoot(nsFileSpec& outSpec) static void GetDefaultsFolder(nsFileSpec& outSpec) //---------------------------------------------------------------------------------------- { - nsSpecialSystemDirectory cwd(nsSpecialSystemDirectory::OS_CurrentProcessDirectory); + nsSpecialSystemDirectory cwd(nsSpecialSystemDirectory::Moz_BinDirectory); #if defined(XP_MAC) cwd += "Defaults"; diff --git a/mozilla/xpfe/bootstrap/nsAppRunner.cpp b/mozilla/xpfe/bootstrap/nsAppRunner.cpp index ddc06ad3927..5c15225b1c3 100644 --- a/mozilla/xpfe/bootstrap/nsAppRunner.cpp +++ b/mozilla/xpfe/bootstrap/nsAppRunner.cpp @@ -674,7 +674,7 @@ int main(int argc, char* argv[]) if( !NS_CanRun() ) return 1; NS_ShowSplashScreen(); - rv = NS_InitXPCOM(NULL, NULL, NULL); + rv = NS_InitXPCOM(NULL, NULL); NS_ASSERTION( NS_SUCCEEDED(rv), "NS_InitXPCOM failed" ); { diff --git a/mozilla/xpinstall/stub/xpistub.cpp b/mozilla/xpinstall/stub/xpistub.cpp index 2e2b28b190c..7553329b8fa 100644 --- a/mozilla/xpinstall/stub/xpistub.cpp +++ b/mozilla/xpinstall/stub/xpistub.cpp @@ -93,36 +93,23 @@ PR_PUBLIC_API(nsresult) XPI_Init( OSErr err = noErr; long xpiStubDirID = 0; Boolean isDir = false; - FSSpec fsRegFile; FSpGetDirectoryID(&aXPIStubDir, &xpiStubDirID, &isDir); - err = FSMakeFSSpec(aXPIStubDir.vRefNum, xpiStubDirID, COMPONENT_REG, &fsRegFile); - if (err!=noErr) - return NS_ERROR_UNEXPECTED; - - nsfsRegFile = fsRegFile; nsfsDirectory = aXPIStubDir; - rv = NS_InitXPCOM(&gServiceMgr, &nsfsRegFile, &nsfsDirectory); + rv = NS_InitXPCOM(&gServiceMgr, &nsfsDirectory); #elif defined(XP_PC) char componentPath[_MAX_PATH]; getcwd(componentPath, _MAX_PATH); - nsfsDirectory = componentPath; - nsfsRegFile = componentPath; - nsfsDirectory += "\\components"; - nsfsRegFile += "\\"; - nsfsRegFile += COMPONENT_REG; + nsfsDirectory = componentPath; - rv = NS_InitXPCOM(&gServiceMgr, &nsfsRegFile, &nsfsDirectory); + rv = NS_InitXPCOM(&gServiceMgr, &nsfsDirectory); #elif defined(XP_UNIX) - nsfsDirectory = aProgramDir; - nsfsRegFile = aProgramDir; - nsfsRegFile += "/"; - nsfsRegFile += COMPONENT_REG; + nsfsDirectory = aProgramDir; - rv = NS_InitXPCOM(&gServiceMgr, &nsfsRegFile, &nsfsDirectory); + rv = NS_InitXPCOM(&gServiceMgr, &nsfsDirectory); #else - rv = NS_InitXPCOM(&gServiceMgr, NULL, NULL); + rv = NS_InitXPCOM(&gServiceMgr, NULL); #endif if (!NS_SUCCEEDED(rv))