diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index c78569dedaa..c2c67b00a9b 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -923,7 +923,10 @@ NS_IMETHODIMP nsExternalHelperAppService::GetApplicationDescription(const nsACSt // Methods related to deleting temporary files on exit ////////////////////////////////////////////////////////////////////////////////////////////////////// -NS_IMETHODIMP nsExternalHelperAppService::DeleteTemporaryFileOnExit(nsIFile * aTemporaryFile) +/* static */ +nsresult +nsExternalHelperAppService::DeleteTemporaryFileHelper(nsIFile * aTemporaryFile, + nsCOMArray &aFileList) { bool isFile = false; @@ -931,14 +934,23 @@ NS_IMETHODIMP nsExternalHelperAppService::DeleteTemporaryFileOnExit(nsIFile * aT aTemporaryFile->IsFile(&isFile); if (!isFile) return NS_OK; - if (mInPrivateBrowsing) - mTemporaryPrivateFilesList.AppendObject(aTemporaryFile); - else - mTemporaryFilesList.AppendObject(aTemporaryFile); + aFileList.AppendObject(aTemporaryFile); return NS_OK; } +NS_IMETHODIMP +nsExternalHelperAppService::DeleteTemporaryFileOnExit(nsIFile* aTemporaryFile) +{ + return DeleteTemporaryFileHelper(aTemporaryFile, mTemporaryFilesList); +} + +NS_IMETHODIMP +nsExternalHelperAppService::DeleteTemporaryPrivateFileWhenPossible(nsIFile* aTemporaryFile) +{ + return DeleteTemporaryFileHelper(aTemporaryFile, mTemporaryPrivateFilesList); +} + void nsExternalHelperAppService::FixFilePermissions(nsIFile* aFile) { // This space intentionally left blank diff --git a/uriloader/exthandler/nsExternalHelperAppService.h b/uriloader/exthandler/nsExternalHelperAppService.h index 59505ba43b3..3813479ccd3 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.h +++ b/uriloader/exthandler/nsExternalHelperAppService.h @@ -172,6 +172,11 @@ protected: * Helper function for ExpungeTemporaryFiles and ExpungeTemporaryPrivateFiles */ static void ExpungeTemporaryFilesHelper(nsCOMArray &fileList); + /** + * Helper function for DeleteTemporaryFileOnExit and DeleteTemporaryPrivateFileWhenPossible + */ + static nsresult DeleteTemporaryFileHelper(nsIFile* aTemporaryFile, + nsCOMArray &aFileList); /** * Functions related to the tempory file cleanup service provided by * nsExternalHelperAppService diff --git a/uriloader/exthandler/nsIExternalHelperAppService.idl b/uriloader/exthandler/nsIExternalHelperAppService.idl index e5ee8b7549e..c0066ec31a3 100644 --- a/uriloader/exthandler/nsIExternalHelperAppService.idl +++ b/uriloader/exthandler/nsIExternalHelperAppService.idl @@ -53,7 +53,7 @@ interface nsIExternalHelperAppService : nsISupports * This is a private interface shared between external app handlers and the platform specific * external helper app service */ -[scriptable, uuid(d0b5d7d3-9565-403d-9fb5-e5089c4567c6)] +[scriptable, uuid(6613e2e7-feab-4e3a-bb1f-b03200d544ec)] interface nsPIExternalAppLauncher : nsISupports { /** @@ -62,6 +62,11 @@ interface nsPIExternalAppLauncher : nsISupports * @param aTemporaryFile A temporary file we should delete on exit. */ void deleteTemporaryFileOnExit(in nsIFile aTemporaryFile); + /** + * Delete a temporary file created inside private browsing mode when + * the private browsing mode has ended. + */ + void deleteTemporaryPrivateFileWhenPossible(in nsIFile aTemporaryFile); }; /**