Bug 1505931 - URL-Classifier should consider all the prefs, r=francois

This commit is contained in:
Andrea Marchesini 2018-12-01 13:04:20 +01:00
Родитель b9156a21d1
Коммит c5f4a7aed6
1 изменённых файлов: 20 добавлений и 14 удалений

Просмотреть файл

@ -1757,27 +1757,33 @@ nsUrlClassifierDBService::AsyncClassifyLocalWithTables(
rv = uri->GetHost(host);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString tables;
for (uint32_t i = 0; i < aExtraEntriesByPrefs.Length(); ++i) {
nsTArray<nsCString> entries;
Classifier::SplitTables(aExtraEntriesByPrefs[i], entries);
if (entries.Contains(host)) {
nsCString table = aExtraTablesByPrefs[i];
nsCOMPtr<nsIURIClassifierCallback> callback(aCallback);
nsCOMPtr<nsIRunnable> cbRunnable = NS_NewRunnableFunction(
"nsUrlClassifierDBService::AsyncClassifyLocalWithTables",
[callback, table]() -> void {
callback->OnClassifyComplete(
NS_OK, // Not used.
table,
EmptyCString(), // provider. (Not used)
EmptyCString()); // prefix. (Not used)
});
NS_DispatchToMainThread(cbRunnable);
return NS_OK;
if (!tables.IsEmpty()) {
tables.AppendLiteral(",");
}
tables.Append(aExtraTablesByPrefs[i]);
}
}
if (!tables.IsEmpty()) {
nsCOMPtr<nsIURIClassifierCallback> callback(aCallback);
nsCOMPtr<nsIRunnable> cbRunnable = NS_NewRunnableFunction(
"nsUrlClassifierDBService::AsyncClassifyLocalWithTables",
[callback, tables]() -> void {
callback->OnClassifyComplete(NS_OK, // Not used.
tables,
EmptyCString(), // provider. (Not used)
EmptyCString()); // prefix. (Not used)
});
NS_DispatchToMainThread(cbRunnable);
return NS_OK;
}
}
nsAutoCString key;