Use the browser.helperApps.deleteTempFileOnExit pref, if set, to decide whether

to delete helper app temp files on exit.  Bug 302433, r=biesi, sr=sfraser
This commit is contained in:
bzbarsky%mit.edu 2005-08-22 17:49:53 +00:00
Родитель 850e79b651
Коммит eb891afa08
1 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@ -2310,12 +2310,28 @@ nsresult nsExternalAppHandler::OpenWithApplication()
} }
else else
{ {
PRBool deleteTempFileOnExit;
nsresult result = NS_ERROR_NOT_AVAILABLE; // don't return this!
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
result = prefs->GetBoolPref("browser.helperApps.deleteTempFileOnExit",
&deleteTempFileOnExit);
}
if (NS_FAILED(result)) {
// No pref set; use default value
#if !defined(XP_MAC) && !defined (XP_MACOSX) #if !defined(XP_MAC) && !defined (XP_MACOSX)
NS_ASSERTION(sSrv, "Service gone away!?"); // Mac users have been very verbal about temp files being deleted on
// Mac users have been very verbal about temp files being deleted on app exit - they // app exit - they don't like it - but we'll continue to do this on
// don't like it - but we'll continue to do this on other platforms for now // other platforms for now.
sSrv->DeleteTemporaryFileOnExit(mFinalFileDestination); deleteTempFileOnExit = PR_TRUE;
#else
deleteTempFileOnExit = PR_FALSE;
#endif #endif
}
if (deleteTempFileOnExit) {
NS_ASSERTION(sSrv, "Service gone away!?");
sSrv->DeleteTemporaryFileOnExit(mFinalFileDestination);
}
} }
} }