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/. */
7 /* The privileged system principal. */
9 #ifndef mozilla_SystemPrincipal_h
10 #define mozilla_SystemPrincipal_h
12 #include "nsIPrincipal.h"
13 #include "nsJSPrincipals.h"
15 #include "mozilla/BasePrincipal.h"
17 #define NS_SYSTEMPRINCIPAL_CID \
19 0x4a6212db, 0xaccb, 0x11d3, { \
20 0xb7, 0x65, 0x0, 0x60, 0xb0, 0xb6, 0xce, 0xcb \
23 #define NS_SYSTEMPRINCIPAL_CONTRACTID "@mozilla.org/systemprincipal;1"
31 class SystemPrincipal final
: public BasePrincipal
{
32 SystemPrincipal() : BasePrincipal(eSystemPrincipal
) {}
35 static already_AddRefed
<SystemPrincipal
> Create();
37 static PrincipalKind
Kind() { return eSystemPrincipal
; }
39 NS_DECL_NSISERIALIZABLE
40 NS_IMETHOD
QueryInterface(REFNSIID aIID
, void** aInstancePtr
) override
;
41 uint32_t GetHashValue() override
;
42 NS_IMETHOD
GetURI(nsIURI
** aURI
) override
;
43 NS_IMETHOD
GetDomain(nsIURI
** aDomain
) override
;
44 NS_IMETHOD
SetDomain(nsIURI
* aDomain
) override
;
45 NS_IMETHOD
GetBaseDomain(nsACString
& aBaseDomain
) override
;
46 NS_IMETHOD
GetAddonId(nsAString
& aAddonId
) override
;
47 NS_IMETHOD
GetIsOriginPotentiallyTrustworthy(bool* aResult
) override
;
49 virtual nsresult
GetScriptLocation(nsACString
& aStr
) override
;
51 nsresult
GetSiteIdentifier(SiteIdentifier
& aSite
) override
{
57 virtual ~SystemPrincipal(void) {}
59 bool SubsumesInternal(nsIPrincipal
* aOther
,
60 DocumentDomainConsideration aConsideration
) override
{
64 bool MayLoadInternal(nsIURI
* aURI
) override
{ return true; }
67 } // namespace mozilla
69 #endif // mozilla_SystemPrincipal_h