Bug 1499384: add debug logging for expandedprincipals r=ckerschb
authorFrederik Braun <fbraun@mozilla.com>
Mon, 22 Oct 2018 12:49:10 +0000
changeset 490692 76763ce5587582f94bcdebd9efb3ce6f625085ea
parent 490691 e7d0ae555a8d4cf6068f84648253fafffe9bf498
child 490693 2e5b99d12a6daf88e4fffa8f80efb7b874f18379
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersckerschb
bugs1499384
milestone64.0a1
Bug 1499384: add debug logging for expandedprincipals r=ckerschb Extending the MOZ_LOGging for content security checks to provide a proper serialization of expanded principals Differential Revision: https://phabricator.services.mozilla.com/D8958
dom/security/nsContentSecurityManager.cpp
--- a/dom/security/nsContentSecurityManager.cpp
+++ b/dom/security/nsContentSecurityManager.cpp
@@ -631,18 +631,21 @@ LogPrincipal(nsIPrincipal* aPrincipal, c
   }
   if (aPrincipal) {
     if (aPrincipal->GetIsNullPrincipal()) {
       MOZ_LOG(sCSMLog, LogLevel::Debug, ("  %s: NullPrincipal\n",
        NS_ConvertUTF16toUTF8(aPrincipalName).get()));
       return;
     }
     if (aPrincipal->GetIsExpandedPrincipal()) {
-      MOZ_LOG(sCSMLog, LogLevel::Debug, ("  %s: Expanded Principal\n",
-        NS_ConvertUTF16toUTF8(aPrincipalName).get()));
+      nsAutoCString origin;
+      aPrincipal->GetOrigin(origin);
+      MOZ_LOG(sCSMLog, LogLevel::Debug, ("  %s: %s\n",
+        NS_ConvertUTF16toUTF8(aPrincipalName).get(),
+        origin.get()));
       return;
     }
     nsCOMPtr<nsIURI> principalURI;
     nsAutoCString principalSpec;
     aPrincipal->GetURI(getter_AddRefs(principalURI));
     if (principalURI) {
       principalURI->GetSpec(principalSpec);
     }