diff --git a/toolkit/components/url-classifier/LookupCache.h b/toolkit/components/url-classifier/LookupCache.h index 139bb4cc47a9..5bca76d08178 100644 --- a/toolkit/components/url-classifier/LookupCache.h +++ b/toolkit/components/url-classifier/LookupCache.h @@ -44,7 +44,13 @@ public: nsCString PartialHash() { MOZ_ASSERT(mPartialHashLength <= COMPLETE_SIZE); - return nsCString(reinterpret_cast(hash.complete.buf), mPartialHashLength); + if (mNoise) { + return nsCString(reinterpret_cast(hash.fixedLengthPrefix.buf), + PREFIX_SIZE); + } else { + return nsCString(reinterpret_cast(hash.complete.buf), + mPartialHashLength); + } } nsCString PartialHashHex() { diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index 9a395eba5090..6481469c40e6 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -1097,10 +1097,7 @@ nsUrlClassifierLookupCallback::LookupComplete(nsTArray* results) // Bug 1323953 - Send the first 4 bytes for completion no matter how // long we matched the prefix. - nsAutoCString partialHash; - partialHash.Assign(reinterpret_cast(&result.hash.fixedLengthPrefix), - PREFIX_SIZE); - nsresult rv = completer->Complete(partialHash, + nsresult rv = completer->Complete(result.PartialHash(), gethashUrl, result.mTableName, this);