Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/caps/SystemPrincipal.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
/* The privileged system principal. */
8
9
#ifndef mozilla_SystemPrincipal_h
10
#define mozilla_SystemPrincipal_h
11
12
#include "nsIPrincipal.h"
13
#include "nsJSPrincipals.h"
14
15
#include "mozilla/BasePrincipal.h"
16
17
#define NS_SYSTEMPRINCIPAL_CID \
18
{ 0x4a6212db, 0xaccb, 0x11d3, \
19
{ 0xb7, 0x65, 0x0, 0x60, 0xb0, 0xb6, 0xce, 0xcb }}
20
#define NS_SYSTEMPRINCIPAL_CONTRACTID "@mozilla.org/systemprincipal;1"
21
22
namespace mozilla {
23
24
class SystemPrincipal final : public BasePrincipal
25
{
26
  SystemPrincipal()
27
    : BasePrincipal(eSystemPrincipal)
28
3
  {
29
3
  }
30
31
public:
32
  static already_AddRefed<SystemPrincipal> Create();
33
34
  static PrincipalKind Kind() { return eSystemPrincipal; }
35
36
  NS_DECL_NSISERIALIZABLE
37
  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
38
  NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
39
  NS_IMETHOD GetURI(nsIURI** aURI) override;
40
  NS_IMETHOD GetDomain(nsIURI** aDomain) override;
41
  NS_IMETHOD SetDomain(nsIURI* aDomain) override;
42
  NS_IMETHOD GetCsp(nsIContentSecurityPolicy** aCsp) override;
43
  NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp) override;
44
  NS_IMETHOD EnsureCSP(nsIDocument* aDocument, nsIContentSecurityPolicy** aCSP) override;
45
  NS_IMETHOD GetPreloadCsp(nsIContentSecurityPolicy** aPreloadCSP) override;
46
  NS_IMETHOD EnsurePreloadCSP(nsIDocument* aDocument, nsIContentSecurityPolicy** aCSP) override;
47
  NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
48
  NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
49
50
  virtual nsresult GetScriptLocation(nsACString &aStr) override;
51
52
3
  nsresult GetSiteIdentifier(SiteIdentifier& aSite) override {
53
3
    aSite.Init(this);
54
3
    return NS_OK;
55
3
  }
56
57
protected:
58
  virtual ~SystemPrincipal(void) {}
59
60
  bool SubsumesInternal(nsIPrincipal *aOther,
61
                        DocumentDomainConsideration aConsideration) override
62
0
  {
63
0
    return true;
64
0
  }
65
66
  bool MayLoadInternal(nsIURI* aURI) override
67
0
  {
68
0
    return true;
69
0
  }
70
};
71
72
} // mozilla namespace
73
74
#endif // mozilla_SystemPrincipal_h