зеркало из https://github.com/mozilla/pjs.git
Fix bad error handling (PRBool vs. nsresult mixup). Bug 197739. r=dbradley, sr=jst
This commit is contained in:
Родитель
74bc4b1058
Коммит
ff2edba8d3
|
@ -179,19 +179,18 @@ xptiInterfaceInfoManager::~xptiInterfaceInfoManager()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static PRBool
|
static nsresult
|
||||||
GetDirectoryFromDirService(const char* codename, nsILocalFile** aDir)
|
GetDirectoryFromDirService(const char* codename, nsILocalFile** aDir)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(codename,"loser!");
|
NS_ASSERTION(codename,"loser!");
|
||||||
NS_ASSERTION(aDir,"loser!");
|
NS_ASSERTION(aDir,"loser!");
|
||||||
|
|
||||||
nsCOMPtr<nsIProperties> dirService =
|
nsresult rv;
|
||||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
|
nsCOMPtr<nsIProperties> dirService =
|
||||||
if(!dirService)
|
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||||
return PR_FALSE;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
return NS_SUCCEEDED(dirService->Get(codename, NS_GET_IID(nsILocalFile),
|
return dirService->Get(codename, NS_GET_IID(nsILocalFile), (void**) aDir);
|
||||||
(void**) aDir));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PRBool
|
static PRBool
|
||||||
|
@ -260,17 +259,17 @@ PRBool xptiInterfaceInfoManager::BuildFileSearchPath(nsISupportsArray** aPath)
|
||||||
nsCOMPtr<nsILocalFile> greComponentDirectory;
|
nsCOMPtr<nsILocalFile> greComponentDirectory;
|
||||||
nsresult rv = GetDirectoryFromDirService(NS_GRE_COMPONENT_DIR,
|
nsresult rv = GetDirectoryFromDirService(NS_GRE_COMPONENT_DIR,
|
||||||
getter_AddRefs(greComponentDirectory));
|
getter_AddRefs(greComponentDirectory));
|
||||||
if (NS_SUCCEEDED(rv) && greComponentDirectory)
|
if(NS_SUCCEEDED(rv) && greComponentDirectory)
|
||||||
{
|
{
|
||||||
// make sure we only append a directory if its a different one
|
// make sure we only append a directory if its a different one
|
||||||
PRBool equalsCompDir = PR_FALSE;
|
PRBool equalsCompDir = PR_FALSE;
|
||||||
greComponentDirectory->Equals(compDir, &equalsCompDir);
|
greComponentDirectory->Equals(compDir, &equalsCompDir);
|
||||||
|
|
||||||
if (!equalsCompDir)
|
if(!equalsCompDir)
|
||||||
searchPath->AppendElement(greComponentDirectory);
|
searchPath->AppendElement(greComponentDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) AppendFromDirServiceList(NS_APP_PLUGINS_DIR_LIST, searchPath);
|
(void)AppendFromDirServiceList(NS_APP_PLUGINS_DIR_LIST, searchPath);
|
||||||
|
|
||||||
NS_ADDREF(*aPath = searchPath);
|
NS_ADDREF(*aPath = searchPath);
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
@ -295,7 +294,7 @@ PRBool
|
||||||
xptiInterfaceInfoManager::GetApplicationDir(nsILocalFile** aDir)
|
xptiInterfaceInfoManager::GetApplicationDir(nsILocalFile** aDir)
|
||||||
{
|
{
|
||||||
// We *trust* that this will not change!
|
// We *trust* that this will not change!
|
||||||
return GetDirectoryFromDirService(NS_XPCOM_CURRENT_PROCESS_DIR, aDir);
|
return NS_SUCCEEDED(GetDirectoryFromDirService(NS_XPCOM_CURRENT_PROCESS_DIR, aDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
|
|
Загрузка…
Ссылка в новой задаче