diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index 5576f86c1bac..7a0c778436d2 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -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 entries; Classifier::SplitTables(aExtraEntriesByPrefs[i], entries); if (entries.Contains(host)) { - nsCString table = aExtraTablesByPrefs[i]; - nsCOMPtr callback(aCallback); - nsCOMPtr 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 callback(aCallback); + nsCOMPtr 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;