Backed out changeset e75d5882e8b2 (bug 912465) for xpcshell crashes on a CLOSED TREE.

This commit is contained in:
Ryan VanderMeulen 2013-11-19 11:13:39 -05:00
Родитель f3d37ad279
Коммит 14f4631e3d
4 изменённых файлов: 25 добавлений и 37 удалений

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

@ -126,21 +126,23 @@ NS_IMETHODIMP nsMsgFilterService::SaveFilterList(nsIMsgFilterList *filterList,
NS_ENSURE_ARG_POINTER(filterFile);
NS_ENSURE_ARG_POINTER(filterList);
nsCOMPtr<nsIOutputStream> strm;
nsresult rv = MsgNewSafeBufferedFileOutputStream(getter_AddRefs(strm),
nsCOMPtr<nsIOutputStream> out;
nsresult rv = NS_NewSafeLocalFileOutputStream(getter_AddRefs(out),
filterFile, -1, 0600);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIOutputStream> strm;
rv = NS_NewBufferedOutputStream(getter_AddRefs(strm), out, 4096);
NS_ENSURE_SUCCESS(rv, rv);
rv = filterList->SaveToFile(strm);
nsCOMPtr<nsISafeOutputStream> safeStream = do_QueryInterface(strm);
NS_ASSERTION(safeStream, "expected a safe output stream!");
if (safeStream) {
NS_ASSERTION(safeStream, "expected a safe output stream");
if (NS_SUCCEEDED(rv) && safeStream)
rv = safeStream->Finish();
if (NS_FAILED(rv)) {
NS_WARNING("failed to save filter file! possible data loss");
}
}
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to save filter file");
return rv;
}

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

@ -3126,25 +3126,23 @@ NS_IMETHODIMP nsMsgAccountManager::SaveVirtualFolders()
GetVirtualFoldersFile(file);
// Open a buffered, safe output stream
nsCOMPtr<nsIOutputStream> outStreamSink;
nsresult rv = NS_NewSafeLocalFileOutputStream(getter_AddRefs(outStreamSink),
file,
PR_CREATE_FILE | PR_WRONLY | PR_TRUNCATE,
0664);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIOutputStream> outStream;
nsresult rv = MsgNewSafeBufferedFileOutputStream(getter_AddRefs(outStream),
file,
PR_CREATE_FILE | PR_WRONLY | PR_TRUNCATE,
0664);
rv = NS_NewBufferedOutputStream(getter_AddRefs(outStream), outStreamSink, 4096);
NS_ENSURE_SUCCESS(rv, rv);
WriteLineToOutputStream("version=", "1", outStream);
m_incomingServers.Enumerate(saveVirtualFolders, &outStream);
nsCOMPtr<nsISafeOutputStream> safeStream = do_QueryInterface(outStream, &rv);
NS_ASSERTION(safeStream, "expected a safe output stream!");
if (safeStream) {
rv = safeStream->Finish();
if (NS_FAILED(rv)) {
NS_WARNING("failed to save personal dictionary file! possible data loss");
}
}
return rv;
NS_ENSURE_SUCCESS(rv, rv);
return safeStream->Finish();
}
PLDHashOperator

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

@ -912,7 +912,9 @@ nsresult nsMsgSaveAsListener::SetupMsgWriteStream(nsIFile *aFile, bool addDummyE
// have to close the stream before deleting the file, else data
// would still be written happily into a now non-existing file.
// (Windows doesn't care, btw, just unixoids do...)
nsresult rv = MsgNewSafeBufferedFileOutputStream(getter_AddRefs(m_outputStream),
aFile->Remove(false);
nsresult rv = MsgNewBufferedFileOutputStream(getter_AddRefs(m_outputStream),
aFile, -1, 0666);
NS_ENSURE_SUCCESS(rv, rv);
@ -936,15 +938,7 @@ nsresult nsMsgSaveAsListener::SetupMsgWriteStream(nsIFile *aFile, bool addDummyE
result += MSG_LINEBREAK;
m_outputStream->Write(result.get(), result.Length(), &writeCount);
}
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISafeOutputStream> safeStream = do_QueryInterface(m_outputStream);
NS_ASSERTION(safeStream, "expected a safe output stream!");
if (safeStream) {
rv = safeStream->Finish();
if (NS_FAILED(rv)) {
NS_WARNING("failed to save msg file! possible data loss");
}
}
return rv;
}

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

@ -353,13 +353,7 @@ net_pop3_write_state(Pop3UidlHost* host, nsIFile *mailDirectory)
}
}
nsCOMPtr<nsISafeOutputStream> safeStream = do_QueryInterface(fileOutputStream);
NS_ASSERTION(safeStream, "expected a safe output stream!");
if (safeStream) {
rv = safeStream->Finish();
if (NS_FAILED(rv)) {
NS_WARNING("failed to save pop state! possible data loss");
}
}
safeStream->Finish();
}
static void