Bug 1522490 - Only get the parent principal URI if logging is enabled; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 25 Jan 2019 08:50:54 +0000
changeset 455440 1ba76553a3bd9ce2aefc64ebd8ed95b80225353a
parent 455439 d815471fff914f9482658278838592eaa62052b0
child 455441 712eb70b540a195fb7435e3f390eb44dbe792840
push id76796
push usereakhgari@mozilla.com
push dateFri, 25 Jan 2019 14:34:02 +0000
treeherderautoland@1ba76553a3bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1522490
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 1522490 - Only get the parent principal URI if logging is enabled; r=baku Differential Revision: https://phabricator.services.mozilla.com/D17502
toolkit/components/antitracking/AntiTrackingCommon.cpp
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -1337,23 +1337,25 @@ bool AntiTrackingCommon::IsFirstPartySto
 
   uint32_t result = 0;
   rv = pm->TestPermissionFromPrincipal(parentPrincipal, type.get(), &result);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     LOG(("Failed to test the permission"));
     return false;
   }
 
-  nsCOMPtr<nsIURI> parentPrincipalURI;
-  Unused << parentPrincipal->GetURI(getter_AddRefs(parentPrincipalURI));
-  LOG_SPEC(
-      ("Testing permission type %s for %s resulted in %d (%s)", type.get(),
-       _spec, int(result),
-       result == nsIPermissionManager::ALLOW_ACTION ? "success" : "failure"),
-      parentPrincipalURI);
+  if (MOZ_LOG_TEST(gAntiTrackingLog, LogLevel::Debug)) {
+    nsCOMPtr<nsIURI> parentPrincipalURI;
+    Unused << parentPrincipal->GetURI(getter_AddRefs(parentPrincipalURI));
+    LOG_SPEC(
+        ("Testing permission type %s for %s resulted in %d (%s)", type.get(),
+         _spec, int(result),
+         result == nsIPermissionManager::ALLOW_ACTION ? "success" : "failure"),
+        parentPrincipalURI);
+  }
 
   return result == nsIPermissionManager::ALLOW_ACTION;
 }
 
 nsresult AntiTrackingCommon::IsOnContentBlockingAllowList(
     nsIURI* aTopWinURI, bool aIsPrivateBrowsing,
     AntiTrackingCommon::ContentBlockingAllowListPurpose aPurpose,
     bool& aIsAllowListed) {