diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp index f550acfca3e5..7c5cbec752cf 100644 --- a/toolkit/components/downloads/nsDownloadManager.cpp +++ b/toolkit/components/downloads/nsDownloadManager.cpp @@ -2879,8 +2879,13 @@ nsDownload::OpenWithApplication() // Even if we are unable to get this service we return the result // of LaunchWithFile() which makes more sense. - if (appLauncher) - (void)appLauncher->DeleteTemporaryFileOnExit(target); + if (appLauncher) { + if (nsDownloadManager::gDownloadManagerService->mInPrivateBrowsing) { + (void)appLauncher->DeleteTemporaryPrivateFileWhenPossible(target); + } else { + (void)appLauncher->DeleteTemporaryFileOnExit(target); + } + } } return retVal;