зеркало из https://github.com/mozilla/pjs.git
random array cleanup. Bug 211193, r=biesi, sr=alecf
This commit is contained in:
Родитель
630bc61580
Коммит
a7f3b22f7e
|
@ -815,36 +815,23 @@ NS_IMETHODIMP nsExternalHelperAppService::DeleteTemporaryFileOnExit(nsIFile * aT
|
|||
localFile->IsFile(&isFile);
|
||||
if (!isFile) return NS_OK;
|
||||
|
||||
if (!mTemporaryFilesList)
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(mTemporaryFilesList));
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mTemporaryFilesList->AppendElement(localFile);
|
||||
mTemporaryFilesList.AppendObject(localFile);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsExternalHelperAppService::ExpungeTemporaryFiles()
|
||||
{
|
||||
if (!mTemporaryFilesList) return NS_OK;
|
||||
|
||||
PRUint32 numEntries = 0;
|
||||
mTemporaryFilesList->Count(&numEntries);
|
||||
nsCOMPtr<nsISupports> element;
|
||||
nsCOMPtr<nsILocalFile> localFile;
|
||||
for (PRUint32 index = 0; index < numEntries; index ++)
|
||||
PRInt32 numEntries = mTemporaryFilesList.Count();
|
||||
nsILocalFile* localFile;
|
||||
for (PRInt32 index = 0; index < numEntries; index++)
|
||||
{
|
||||
element = getter_AddRefs(mTemporaryFilesList->ElementAt(index));
|
||||
if (element)
|
||||
{
|
||||
localFile = do_QueryInterface(element);
|
||||
if (localFile)
|
||||
localFile->Remove(PR_FALSE);
|
||||
}
|
||||
localFile = mTemporaryFilesList[index];
|
||||
if (localFile)
|
||||
localFile->Remove(PR_FALSE);
|
||||
}
|
||||
|
||||
mTemporaryFilesList->Clear();
|
||||
mTemporaryFilesList.Clear();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsHashtable.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
class nsExternalAppHandler;
|
||||
|
@ -147,7 +147,7 @@ protected:
|
|||
protected:
|
||||
// functions related to the tempory file cleanup service provided by nsExternalHelperAppService
|
||||
nsresult ExpungeTemporaryFiles();
|
||||
nsCOMPtr<nsISupportsArray> mTemporaryFilesList;
|
||||
nsCOMArray<nsILocalFile> mTemporaryFilesList;
|
||||
};
|
||||
|
||||
// this is a small private struct used to help us initialize some
|
||||
|
|
Загрузка…
Ссылка в новой задаче