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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef ExpandedPrincipal_h
       7             : #define ExpandedPrincipal_h
       8             : 
       9             : #include "nsCOMPtr.h"
      10             : #include "nsJSPrincipals.h"
      11             : #include "nsTArray.h"
      12             : #include "nsNetUtil.h"
      13             : #include "mozilla/BasePrincipal.h"
      14             : 
      15             : class ExpandedPrincipal : public nsIExpandedPrincipal
      16             :                         , public mozilla::BasePrincipal
      17             : {
      18             : public:
      19             :   static already_AddRefed<ExpandedPrincipal>
      20             :   Create(nsTArray<nsCOMPtr<nsIPrincipal>>& aWhiteList,
      21             :          const mozilla::OriginAttributes& aAttrs);
      22             : 
      23             :   NS_DECL_NSIEXPANDEDPRINCIPAL
      24             :   NS_DECL_NSISERIALIZABLE
      25             : 
      26           0 :   NS_IMETHOD_(MozExternalRefCountType) AddRef() override { return nsJSPrincipals::AddRef(); };
      27           0 :   NS_IMETHOD_(MozExternalRefCountType) Release() override { return nsJSPrincipals::Release(); };
      28             :   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
      29             :   NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
      30             :   NS_IMETHOD GetURI(nsIURI** aURI) override;
      31             :   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
      32             :   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
      33             :   NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
      34             :   NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
      35             :   virtual bool AddonHasPermission(const nsAString& aPerm) override;
      36             :   virtual nsresult GetScriptLocation(nsACString &aStr) override;
      37             : 
      38             : protected:
      39             :   explicit ExpandedPrincipal(nsTArray<nsCOMPtr<nsIPrincipal>> &aWhiteList);
      40             : 
      41             :   virtual ~ExpandedPrincipal();
      42             : 
      43             :   bool SubsumesInternal(nsIPrincipal* aOther,
      44             :                         DocumentDomainConsideration aConsideration) override;
      45             : 
      46             :   bool MayLoadInternal(nsIURI* aURI) override;
      47             : 
      48             : private:
      49             :   nsTArray< nsCOMPtr<nsIPrincipal> > mPrincipals;
      50             : };
      51             : 
      52             : #define NS_EXPANDEDPRINCIPAL_CONTRACTID "@mozilla.org/expandedprincipal;1"
      53             : #define NS_EXPANDEDPRINCIPAL_CID \
      54             : { 0xe8ee88b0, 0x5571, 0x4086, \
      55             :   { 0xa4, 0x5b, 0x39, 0xa7, 0x16, 0x90, 0x6b, 0xdb } }
      56             : 
      57             : #endif // ExpandedPrincipal_h

Generated by: LCOV version 1.13