LCOV - code coverage report
Current view: top level - toolkit/components/alerts - nsAlertsUtils.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 16 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       3             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #include "nsAlertsUtils.h"
       6             : 
       7             : #include "nsCOMPtr.h"
       8             : #include "nsContentUtils.h"
       9             : #include "nsIStringBundle.h"
      10             : #include "nsIURI.h"
      11             : #include "nsXPIDLString.h"
      12             : 
      13             : /* static */
      14             : bool
      15           0 : nsAlertsUtils::IsActionablePrincipal(nsIPrincipal* aPrincipal)
      16             : {
      17           0 :   return aPrincipal &&
      18           0 :          !nsContentUtils::IsSystemOrExpandedPrincipal(aPrincipal) &&
      19           0 :          !aPrincipal->GetIsNullPrincipal();
      20             : }
      21             : 
      22             : /* static */
      23             : void
      24           0 : nsAlertsUtils::GetSourceHostPort(nsIPrincipal* aPrincipal,
      25             :                                  nsAString& aHostPort)
      26             : {
      27           0 :   if (!IsActionablePrincipal(aPrincipal)) {
      28           0 :     return;
      29             :   }
      30           0 :   nsCOMPtr<nsIURI> principalURI;
      31           0 :   if (NS_WARN_IF(NS_FAILED(
      32             :       aPrincipal->GetURI(getter_AddRefs(principalURI))))) {
      33           0 :     return;
      34             :   }
      35           0 :   if (!principalURI) {
      36           0 :     return;
      37             :   }
      38           0 :   nsAutoCString hostPort;
      39           0 :   if (NS_WARN_IF(NS_FAILED(principalURI->GetHostPort(hostPort)))) {
      40           0 :     return;
      41             :   }
      42           0 :   CopyUTF8toUTF16(hostPort, aHostPort);
      43             : }

Generated by: LCOV version 1.13