Bug 1287059 - Part 1: Return all possible list names while converting from threat type. r=francois.
MozReview-Commit-ID: KgT4CrBzvu0
This commit is contained in:
@@ -791,15 +791,33 @@ ProtocolParserProtobuf::ProcessOneResponse(const ListUpdateResponse& aResponse)
|
||||
// Convert threat type to list name.
|
||||
nsCOMPtr<nsIUrlClassifierUtils> urlUtil =
|
||||
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
|
||||
nsCString listName;
|
||||
nsresult rv = urlUtil->ConvertThreatTypeToListName(aResponse.threat_type(),
|
||||
listName);
|
||||
nsCString possibleListNames;
|
||||
nsresult rv = urlUtil->ConvertThreatTypeToListNames(aResponse.threat_type(),
|
||||
possibleListNames);
|
||||
if (NS_FAILED(rv)) {
|
||||
PARSER_LOG((nsPrintfCString("Threat type to list name conversion error: %d",
|
||||
aResponse.threat_type())).get());
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Match the table name we received with one of the ones we requested.
|
||||
// We ignore the case where a threat type matches more than one list
|
||||
// per provider and return the first one. See bug 1287059."
|
||||
nsCString listName;
|
||||
nsTArray<nsCString> possibleListNameArray;
|
||||
Classifier::SplitTables(possibleListNames, possibleListNameArray);
|
||||
for (auto possibleName : possibleListNameArray) {
|
||||
if (mRequestedTables.Contains(possibleName)) {
|
||||
listName = possibleName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (listName.IsEmpty()) {
|
||||
PARSER_LOG(("We received an update for a list we didn't ask for. Ignoring it."));
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Test if this is a full update.
|
||||
bool isFullUpdate = false;
|
||||
if (aResponse.has_response_type()) {
|
||||
|
||||
Reference in New Issue
Block a user