Bug 807847 - Noise entries are erroneously entered into the misscache. r=dcamp a=akeybl
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Sat, 03 Nov 2012 01:53:10 +0100
changeset 109774 6e071059b71c51ca6194137f0a3f30ef9f148608
parent 109773 1fe8fd75e5d554b53e458ca510b253122012bd10
child 109775 07fe19d85b51178e8039e93588c21568aebae80d
push id1665
push usergpascutto@mozilla.com
push dateMon, 05 Nov 2012 14:54:02 +0000
treeherdermozilla-beta@6e071059b71c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdcamp, akeybl
bugs807847
milestone17.0
Bug 807847 - Noise entries are erroneously entered into the misscache. r=dcamp a=akeybl
toolkit/components/url-classifier/Classifier.cpp
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
--- a/toolkit/components/url-classifier/Classifier.cpp
+++ b/toolkit/components/url-classifier/Classifier.cpp
@@ -779,16 +779,18 @@ Classifier::ReadNoiseEntries(const Prefi
     return NS_ERROR_FAILURE;
   }
 
   idx -= idx % aCount;
 
   for (int32_t i = 0; (i < aCount) && ((idx+i) < prefixes.Length()); i++) {
     Prefix newPref;
     newPref.FromUint32(prefixes[idx+i]);
-    aNoiseEntries->AppendElement(newPref);
+    if (newPref != aPrefix) {
+      aNoiseEntries->AppendElement(newPref);
+    }
   }
 
   return NS_OK;
 }
 
 }
 }
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -981,17 +981,17 @@ nsUrlClassifierLookupCallback::HandleRes
   // Some parts of this gethash request generated no hits at all.
   // Prefixes must have been removed from the database since our last update.
   // Save the prefixes we checked to prevent repeated requests
   // until the next update.
   nsAutoPtr<PrefixArray> cacheMisses(new PrefixArray());
   if (cacheMisses) {
     for (uint32 i = 0; i < mResults->Length(); i++) {
       LookupResult &result = mResults->ElementAt(i);
-      if (!result.Confirmed()) {
+      if (!result.Confirmed() && !result.mNoise) {
         cacheMisses->AppendElement(result.PrefixHash());
       }
     }
     // Hands ownership of the miss array back to the worker thread.
     mDBService->CacheMisses(cacheMisses.forget());
   }
 
   if (mCacheResults) {