Bug 1323953 - Send 4-byte prefix for both v2/v4 tables. r=francois
MozReview-Commit-ID: 1jlBdSQARNg
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -991,30 +991,21 @@ nsUrlClassifierLookupCallback::LookupCom
// we may have found a prefix in an existing table before the listmanager
// has registered the table. In the second case we should not call
// complete.
if ((!gethashUrl.IsEmpty() ||
StringBeginsWith(result.mTableName, NS_LITERAL_CSTRING("test"))) &&
mDBService->GetCompleter(result.mTableName,
getter_AddRefs(completer))) {
- // TODO: Figure out how long the partial hash should be sent
- // for completion. See Bug 1323953.
+ // Bug 1323953 - Send the first 4 bytes for completion no matter how
+ // long we matched the prefix.
nsAutoCString partialHash;
- if (StringEndsWith(result.mTableName, NS_LITERAL_CSTRING("-proto"))) {
- // We send the complete partial hash for v4 at the moment.
- partialHash = result.PartialHash();
- } else {
- // We always send the first 4 bytes of the partial hash for
- // non-v4 tables. This matters when we have 32-byte prefix
- // in "test-xxx-simple" test data.
- partialHash.Assign(reinterpret_cast<char*>(&result.hash.fixedLengthPrefix),
- PREFIX_SIZE);
- }
-
+ partialHash.Assign(reinterpret_cast<char*>(&result.hash.fixedLengthPrefix),
+ PREFIX_SIZE);
nsresult rv = completer->Complete(partialHash,
gethashUrl,
result.mTableName,
this);
if (NS_SUCCEEDED(rv)) {
mPendingCompletions++;
}
} else {