Bug 1520519 - Cleanup nsUrlClassifierDBService::Lookup method, r=dimi
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 16 Jan 2019 22:49:26 +0100
changeset 514200 722bd413de72d9422924c052648a098ae48f3d4d
parent 514199 1293016267a73f6408b93c203e8b28242b2e2be6
child 514201 7973453599bb4562c4a13b9a91027ac9724640ff
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdimi
bugs1520519
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1520519 - Cleanup nsUrlClassifierDBService::Lookup method, r=dimi
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -2163,32 +2163,28 @@ nsresult nsUrlClassifierDBService::Looku
   nsCOMPtr<nsIUrlClassifierUtils> utilsService =
       do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
   rv = utilsService->GetKeyForURI(uri, key);
   if (NS_FAILED(rv)) return rv;
 
   if (forceLookup) {
     *didLookup = true;
   } else {
-    bool clean = false;
-
-    if (!clean) {
-      nsCOMPtr<nsIPermissionManager> permissionManager =
-          services::GetPermissionManager();
-
-      if (permissionManager) {
-        uint32_t perm;
-        rv = permissionManager->TestPermissionFromPrincipal(
-            aPrincipal, "safe-browsing", &perm);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        clean |= (perm == nsIPermissionManager::ALLOW_ACTION);
-      }
+    nsCOMPtr<nsIPermissionManager> permissionManager =
+        services::GetPermissionManager();
+    if (NS_WARN_IF(!permissionManager)) {
+      return NS_ERROR_FAILURE;
     }
 
+    uint32_t perm;
+    rv = permissionManager->TestPermissionFromPrincipal(
+        aPrincipal, "safe-browsing", &perm);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    bool clean = (perm == nsIPermissionManager::ALLOW_ACTION);
     *didLookup = !clean;
     if (clean) {
       return NS_OK;
     }
   }
 
   // Create an nsUrlClassifierLookupCallback object.  This object will
   // take care of confirming partial hash matches if necessary before