Bug 1434206 - Assert that gethash processing happens on the right thread. r?gcp
MozReview-Commit-ID: FbF8LzCZ3XO
--- a/toolkit/components/url-classifier/Classifier.cpp
+++ b/toolkit/components/url-classifier/Classifier.cpp
@@ -871,16 +871,21 @@ Classifier::ApplyUpdatesForeground(nsres
ResetTables(Clear_All, nsTArray<nsCString> { nsCString(aFailedTableName) });
}
return aBackgroundRv;
}
nsresult
Classifier::ApplyFullHashes(nsTArray<TableUpdate*>* aUpdates)
{
+ MOZ_ASSERT(NS_GetCurrentThread() != mUpdateThread,
+ "ApplyFullHashes() MUST NOT be called on update thread");
+ MOZ_ASSERT(!NS_IsMainThread(),
+ "ApplyFullHashes() must be called on the classifier worker thread.");
+
LOG(("Applying %zu table gethashes.", aUpdates->Length()));
ScopedUpdatesClearer scopedUpdatesClearer(aUpdates);
for (uint32_t i = 0; i < aUpdates->Length(); i++) {
TableUpdate *update = aUpdates->ElementAt(i);
nsresult rv = UpdateCache(update);
NS_ENSURE_SUCCESS(rv, rv);