Bug 807822 - No noise added to completion request in some circumstances. r=dcamp
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Sat, 03 Nov 2012 01:53:11 +0100
changeset 120855 a82389691227e07d67735eab8f9cfb33583d83dd
parent 120854 30bdcaf34723bf5a1057e6d217928f3214c9c06c
child 120856 2718739a1c835fe960dfee9b91d717c2c4e30f6f
push id273
push userlsblakk@mozilla.com
push dateThu, 14 Feb 2013 23:19:38 +0000
treeherdermozilla-release@c5e807a3f8b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdcamp
bugs807822
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 807822 - No noise added to completion request in some circumstances. r=dcamp
toolkit/components/url-classifier/LookupCache.cpp
--- a/toolkit/components/url-classifier/LookupCache.cpp
+++ b/toolkit/components/url-classifier/LookupCache.cpp
@@ -194,24 +194,16 @@ nsresult
 LookupCache::Has(const Completion& aCompletion,
                  const Completion& aHostkey,
                  const uint32_t aHashKey,
                  bool* aHas, bool* aComplete,
                  Prefix* aOrigPrefix)
 {
   *aHas = *aComplete = false;
 
-  // check completion store first
-  if (mCompletions.BinaryIndexOf(aCompletion) != nsTArray<Completion>::NoIndex) {
-    LOG(("Complete in %s", mTableName.get()));
-    *aComplete = true;
-    *aHas = true;
-    return NS_OK;
-  }
-
   uint32_t prefix = aCompletion.ToUint32();
   uint32_t hostkey = aHostkey.ToUint32();
   uint32_t codedkey;
   nsresult rv = KeyedHash(prefix, hostkey, aHashKey, &codedkey, !mPerClientRandomize);
   NS_ENSURE_SUCCESS(rv, rv);
 
   Prefix codedPrefix;
   codedPrefix.FromUint32(codedkey);
@@ -222,16 +214,22 @@ LookupCache::Has(const Completion& aComp
   NS_ENSURE_SUCCESS(rv, rv);
 
   LOG(("Probe in %s: %X, found %d", mTableName.get(), prefix, found));
 
   if (found) {
     *aHas = true;
   }
 
+  if (mCompletions.BinaryIndexOf(aCompletion) != nsTArray<Completion>::NoIndex) {
+    LOG(("Complete in %s", mTableName.get()));
+    *aComplete = true;
+    *aHas = true;
+  }
+
   return NS_OK;
 }
 
 nsresult
 LookupCache::WriteFile()
 {
   nsCOMPtr<nsIFile> storeFile;
   nsresult rv = mStoreDirectory->Clone(getter_AddRefs(storeFile));