Bug 1356427 - P1. Remove redundant code from PendingLookup::LookupNext. r=francois
authorDimi Lee <dlee@mozilla.com>
Thu, 18 Oct 2018 14:38:14 +0000
changeset 490296 ced08ec47ace994bf5c5f1e4052052e7cb9bab30
parent 490295 77d3179f96db09f41d591b62d341ba53604bc24c
child 490297 c3e09876ab13c1b27355f2d0680b0e34a40bbcf4
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersfrancois
bugs1356427
milestone64.0a1
Bug 1356427 - P1. Remove redundant code from PendingLookup::LookupNext. r=francois When mBlocklistCount is set, we will call PendingLookup::OnComplete() to block this download. The |if(mBlocklistCount)| in PendingLookup::LookupNext will never be true. mBlocklistCount member variable is also useless after removing the code. But I think we can keep it since we have mAllowlistCount and we might also need it in the future. Differential Revision: https://phabricator.services.mozilla.com/D8682
toolkit/components/reputationservice/ApplicationReputation.cpp
--- a/toolkit/components/reputationservice/ApplicationReputation.cpp
+++ b/toolkit/components/reputationservice/ApplicationReputation.cpp
@@ -844,22 +844,18 @@ PendingLookup::GetDownloadType(const nsA
 
 nsresult
 PendingLookup::LookupNext()
 {
   // We must call LookupNext or SendRemoteQuery upon return.
   // Look up all of the URLs that could allow or block this download.
   // Blocklist first.
 
-  // If any of mAnylistSpecs or mBlocklistSpecs matched the blocklist,
-  // go ahead and block.
-  if (mBlocklistCount > 0) {
-    return OnComplete(true, NS_OK,
-                      nsIApplicationReputationService::VERDICT_DANGEROUS);
-  }
+  // If a url is in blocklist we should call PendingLookup::OnComplete directly.
+  MOZ_ASSERT(mBlocklistCount == 0);
 
   int index = mAnylistSpecs.Length() - 1;
   nsCString spec;
   if (index >= 0) {
     // Check the source URI only.
     spec = mAnylistSpecs[index];
     mAnylistSpecs.RemoveElementAt(index);
     RefPtr<PendingDBLookup> lookup(new PendingDBLookup(this));