Bug 1434206 - Assert that gethash processing happens on the right thread. r?gcp draft
authorFrancois Marier <francois@mozilla.com>
Fri, 11 May 2018 11:47:26 -0700
changeset 467865 47906774d58d
parent 467864 e194843f5b7a
child 467866 f6a657bca64f
push id180
push userfmarier@mozilla.com
push dateTue, 29 May 2018 01:16:16 +0000
reviewersgcp
bugs1434206
milestone62.0a1
Bug 1434206 - Assert that gethash processing happens on the right thread. r?gcp MozReview-Commit-ID: FbF8LzCZ3XO
toolkit/components/url-classifier/Classifier.cpp
--- 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);