Bug 663899 - Use the win temp file handling code in all platforms. r=smichaud.

This commit is contained in:
Rafael Ávila de Espíndola 2011-08-29 15:45:03 -04:00
parent af3d8d9fb7
commit 0e312750b4

View File

@ -1459,8 +1459,7 @@ nsresult nsExternalAppHandler::SetUpTempFile(nsIChannel * aChannel)
tempLeafName.Append(ext);
}
#ifdef XP_WIN
// On windows, we need to temporarily create a dummy file with the correct
// We need to temporarily create a dummy file with the correct
// file extension to determine the executable-ness, so do this before adding
// the extra .part extension.
nsCOMPtr<nsIFile> dummyFile;
@ -1476,7 +1475,6 @@ nsresult nsExternalAppHandler::SetUpTempFile(nsIChannel * aChannel)
// Store executable-ness then delete
dummyFile->IsExecutable(&mTempFileIsExecutable);
dummyFile->Remove(PR_FALSE);
#endif
// Add an additional .part to prevent the OS from running this file in the
// default application.
@ -1488,12 +1486,6 @@ nsresult nsExternalAppHandler::SetUpTempFile(nsIChannel * aChannel)
rv = mTempFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600);
NS_ENSURE_SUCCESS(rv, rv);
#ifndef XP_WIN
// On other platforms, the file permission bits are used, so we can just call
// IsExecutable
mTempFile->IsExecutable(&mTempFileIsExecutable);
#endif
nsCOMPtr<nsIOutputStream> outputStream;
rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), mTempFile,
PR_WRONLY | PR_CREATE_FILE, 0600);