Bug 725597 - SafeBrowsing fails to update persistent PrefixSet on Windows. r=dcamp

This commit is contained in:
Gian-Carlo Pascutto 2012-08-15 09:04:51 +02:00
parent 1055fd4f4a
commit 1caaad7538
3 changed files with 10 additions and 2 deletions

View File

@ -587,7 +587,8 @@ Classifier::ApplyTableUpdates(nsTArray<TableUpdate*>* aUpdates,
#if defined(DEBUG) && defined(PR_LOGGING)
prefixSet->Dump();
#endif
prefixSet->WriteFile();
rv = prefixSet->WriteFile();
NS_ENSURE_SUCCESS(rv, rv);
// This will drop all the temporary storage used during the update.
rv = store->FinishUpdate();

View File

@ -259,6 +259,13 @@ LookupCache::WriteFile()
rv = storeFile->AppendNative(mTableName + NS_LITERAL_CSTRING(CACHE_SUFFIX));
NS_ENSURE_SUCCESS(rv, rv);
// Need to close the inputstream here *before* rewriting its file.
// Windows will fail if we don't.
if (mInputStream) {
rv = mInputStream->Close();
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIOutputStream> out;
rv = NS_NewSafeLocalFileOutputStream(getter_AddRefs(out), storeFile,
PR_WRONLY | PR_TRUNCATE | PR_CREATE_FILE);

View File

@ -43,8 +43,8 @@ function delFile(name) {
}
function cleanUp() {
delFile("classifier.hashkey");
delFile("urlclassifier3.sqlite");
delFile("safebrowsing/classifier.hashkey");
delFile("safebrowsing/test-phish-simple.sbstore");
delFile("safebrowsing/test-malware-simple.sbstore");
delFile("safebrowsing/test-phish-simple.cache");