Backout e9291f227d63 (Bug 725597). rs=dcamp a=akeybl
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Tue, 01 May 2012 12:13:03 +0200
changeset 92153 eab0fd65945b2198b7bebc31b975ac75942c2459
parent 92152 c70e9dd2057b41dac13bfbedd8313ec69175eddd
child 92154 4b492c012d6c93fb128c2d4d7ce10a010b7ee2dd
push idunknown
push userunknown
push dateunknown
reviewersdcamp, akeybl
bugs725597
milestone13.0
backs oute9291f227d6304d0aea43a3dcb6a96ed97fdffb7
Backout e9291f227d63 (Bug 725597). rs=dcamp a=akeybl
toolkit/components/url-classifier/Classifier.cpp
toolkit/components/url-classifier/LookupCache.cpp
toolkit/components/url-classifier/tests/unit/head_urlclassifier.js
--- a/toolkit/components/url-classifier/Classifier.cpp
+++ b/toolkit/components/url-classifier/Classifier.cpp
@@ -582,18 +582,17 @@ Classifier::ApplyTableUpdates(nsTArray<T
 
   // At this point the store is updated and written out to disk, but
   // the data is still in memory.  Build our quick-lookup table here.
   rv = prefixSet->Build(store->AddPrefixes(), store->AddCompletes());
   NS_ENSURE_SUCCESS(rv, rv);
 #if defined(DEBUG) && defined(PR_LOGGING)
   prefixSet->Dump();
 #endif
-  rv = prefixSet->WriteFile();
-  NS_ENSURE_SUCCESS(rv, rv);
+  prefixSet->WriteFile();
 
   // This will drop all the temporary storage used during the update.
   rv = store->FinishUpdate();
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (updateFreshness) {
     PRInt64 now = (PR_Now() / PR_USEC_PER_SEC);
     LOG(("Successfully updated %s", PromiseFlatCString(store->TableName()).get()));
--- a/toolkit/components/url-classifier/LookupCache.cpp
+++ b/toolkit/components/url-classifier/LookupCache.cpp
@@ -254,23 +254,16 @@ nsresult
 LookupCache::WriteFile()
 {
   nsCOMPtr<nsIFile> storeFile;
   nsresult rv = mStoreDirectory->Clone(getter_AddRefs(storeFile));
   NS_ENSURE_SUCCESS(rv, rv);
   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);
   NS_ENSURE_SUCCESS(rv, rv);
 
   UpdateHeader();
   LOG(("Writing %d completions", mHeader.numCompletions));
 
--- a/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js
+++ b/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js
@@ -31,18 +31,18 @@ function delFile(name) {
     file.append(name);
     if (file.exists())
       file.remove(false);
   } catch(e) {
   }
 }
 
 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");
   delFile("safebrowsing/test-malware-simple.cache");
   delFile("safebrowsing/test-phish-simple.pset");
   delFile("safebrowsing/test-malware-simple.pset");
 }