Bug 947585 - Return result when get OS apply dir failed. r=marshall

This commit is contained in:
Kai-Zhen Li 2013-12-09 14:10:08 +08:00
parent fa3cf845c6
commit 335bcadaa9

View File

@ -606,9 +606,12 @@ GetOSApplyToDir(nsACString& applyToDir)
NS_ASSERTION(ds, "Can't get directory service");
nsCOMPtr<nsIFile> osApplyToDir;
DebugOnly<nsresult> rv = ds->Get(XRE_OS_UPDATE_APPLY_TO_DIR, NS_GET_IID(nsIFile),
nsresult rv = ds->Get(XRE_OS_UPDATE_APPLY_TO_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(osApplyToDir));
NS_ASSERTION(NS_SUCCEEDED(rv), "Can't get the OS applyTo dir");
if (NS_FAILED(rv)) {
LOG(("Can't get the OS applyTo dir"));
return rv;
}
return osApplyToDir->GetNativePath(applyToDir);
}
@ -1140,14 +1143,20 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate)
// This needs to be done on the main thread, so we pass it along in
// BackgroundThreadInfo
nsresult rv = GetOSApplyToDir(osApplyToDir);
NS_ASSERTION(NS_SUCCEEDED(rv), "Can't get the OS apply to dir");
if (NS_FAILED(rv)) {
LOG(("Can't get the OS apply to dir"));
return rv;
}
SetOSApplyToDir(aUpdate, osApplyToDir);
mInfo.mIsOSUpdate = true;
rv = NS_NewNativeLocalFile(osApplyToDir, false,
getter_AddRefs(mInfo.mOSApplyToDir));
NS_ASSERTION(NS_SUCCEEDED(rv), "Can't create nsIFile for OS apply to dir");
if (NS_FAILED(rv)) {
LOG(("Can't create nsIFile for OS apply to dir"));
return rv;
}
}
#endif