зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1077099: Set mGREBinDir in nsXREDirProvider::Initialize to avoid returning NULL in nsXREDirProvider::GetGREBinDir. r=bsmedberg
This commit is contained in:
Родитель
fa889ad57c
Коммит
5704902134
|
@ -62,11 +62,13 @@ public:
|
|||
XPCShellDirProvider() { }
|
||||
~XPCShellDirProvider() { }
|
||||
|
||||
bool SetGREDir(const char *dir);
|
||||
void ClearGREDir() { mGREDir = nullptr; }
|
||||
bool SetGREDirs(const char *dir);
|
||||
void ClearGREDirs() { mGREDir = nullptr;
|
||||
mGREBinDir = nullptr; }
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIFile> mGREDir;
|
||||
nsCOMPtr<nsIFile> mGREBinDir;
|
||||
};
|
||||
|
||||
inline XPCShellEnvironment*
|
||||
|
@ -411,9 +413,15 @@ XPCShellDirProvider::Release()
|
|||
NS_IMPL_QUERY_INTERFACE(XPCShellDirProvider, nsIDirectoryServiceProvider)
|
||||
|
||||
bool
|
||||
XPCShellDirProvider::SetGREDir(const char *dir)
|
||||
XPCShellDirProvider::SetGREDirs(const char *dir)
|
||||
{
|
||||
nsresult rv = XRE_GetFileFromPath(dir, getter_AddRefs(mGREDir));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mGREDir->Clone(getter_AddRefs(mGREBinDir));
|
||||
#ifdef XP_MACOSX
|
||||
mGREBinDir->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS"));
|
||||
#endif
|
||||
}
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
|
@ -426,6 +434,10 @@ XPCShellDirProvider::GetFile(const char *prop,
|
|||
*persistent = true;
|
||||
NS_ADDREF(*result = mGREDir);
|
||||
return NS_OK;
|
||||
} else if (mGREBinDir && !strcmp(prop, NS_GRE_BIN_DIR)) {
|
||||
*persistent = true;
|
||||
NS_ADDREF(*result = mGREBinDir);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -103,6 +103,10 @@ nsXREDirProvider::Initialize(nsIFile *aXULAppDir,
|
|||
mAppProvider = aAppProvider;
|
||||
mXULAppDir = aXULAppDir;
|
||||
mGREDir = aGREDir;
|
||||
mGREDir->Clone(getter_AddRefs(mGREBinDir));
|
||||
#ifdef XP_MACOSX
|
||||
mGREBinDir->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS"));
|
||||
#endif
|
||||
|
||||
if (!mProfileDir) {
|
||||
nsCOMPtr<nsIDirectoryServiceProvider> app(do_QueryInterface(mAppProvider));
|
||||
|
@ -279,12 +283,6 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
|
|||
return mGREDir->Clone(aFile);
|
||||
}
|
||||
else if (!strcmp(aProperty, NS_GRE_BIN_DIR)) {
|
||||
if (!mGREBinDir) {
|
||||
mGREDir->Clone(getter_AddRefs(mGREBinDir));
|
||||
#ifdef XP_MACOSX
|
||||
mGREBinDir->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS"));
|
||||
#endif
|
||||
}
|
||||
return mGREBinDir->Clone(aFile);
|
||||
}
|
||||
else if (!strcmp(aProperty, NS_OS_CURRENT_PROCESS_DIR) ||
|
||||
|
|
Загрузка…
Ссылка в новой задаче