2015-05-12 00:36:56 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-11-12 01:10:36 +03:00
|
|
|
|
1999-09-01 04:54:35 +04:00
|
|
|
/* The privileged system principal. */
|
1999-11-12 01:10:36 +03:00
|
|
|
|
2018-07-17 22:38:19 +03:00
|
|
|
#ifndef mozilla_SystemPrincipal_h
|
|
|
|
#define mozilla_SystemPrincipal_h
|
1999-09-01 04:54:35 +04:00
|
|
|
|
2003-10-22 02:11:49 +04:00
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "nsJSPrincipals.h"
|
1999-09-01 04:54:35 +04:00
|
|
|
|
2015-05-12 00:36:56 +03:00
|
|
|
#include "mozilla/BasePrincipal.h"
|
|
|
|
|
1999-09-01 04:54:35 +04:00
|
|
|
#define NS_SYSTEMPRINCIPAL_CID \
|
2000-01-06 03:59:18 +03:00
|
|
|
{ 0x4a6212db, 0xaccb, 0x11d3, \
|
|
|
|
{ 0xb7, 0x65, 0x0, 0x60, 0xb0, 0xb6, 0xce, 0xcb }}
|
2001-07-31 23:05:34 +04:00
|
|
|
#define NS_SYSTEMPRINCIPAL_CONTRACTID "@mozilla.org/systemprincipal;1"
|
2000-01-06 03:59:18 +03:00
|
|
|
|
2018-07-17 22:38:19 +03:00
|
|
|
namespace mozilla {
|
1999-09-01 04:54:35 +04:00
|
|
|
|
2018-07-17 22:38:19 +03:00
|
|
|
class SystemPrincipal final : public BasePrincipal
|
2003-10-22 02:11:49 +04:00
|
|
|
{
|
2017-03-22 13:39:08 +03:00
|
|
|
SystemPrincipal()
|
2017-02-25 01:02:24 +03:00
|
|
|
: BasePrincipal(eSystemPrincipal)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1999-09-01 04:54:35 +04:00
|
|
|
public:
|
2017-03-22 13:39:08 +03:00
|
|
|
static already_AddRefed<SystemPrincipal> Create();
|
2017-02-25 01:02:24 +03:00
|
|
|
|
2017-04-16 23:32:42 +03:00
|
|
|
static PrincipalKind Kind() { return eSystemPrincipal; }
|
|
|
|
|
2015-05-12 00:36:56 +03:00
|
|
|
NS_DECL_NSISERIALIZABLE
|
|
|
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
|
|
|
|
NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
|
|
|
|
NS_IMETHOD GetURI(nsIURI** aURI) override;
|
|
|
|
NS_IMETHOD GetDomain(nsIURI** aDomain) override;
|
|
|
|
NS_IMETHOD SetDomain(nsIURI* aDomain) override;
|
2015-05-16 00:54:21 +03:00
|
|
|
NS_IMETHOD GetCsp(nsIContentSecurityPolicy** aCsp) override;
|
2017-01-30 16:09:37 +03:00
|
|
|
NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp) override;
|
2018-05-11 20:46:15 +03:00
|
|
|
NS_IMETHOD EnsureCSP(nsIDocument* aDocument, nsIContentSecurityPolicy** aCSP) override;
|
2015-11-15 06:28:23 +03:00
|
|
|
NS_IMETHOD GetPreloadCsp(nsIContentSecurityPolicy** aPreloadCSP) override;
|
2018-05-11 20:46:15 +03:00
|
|
|
NS_IMETHOD EnsurePreloadCSP(nsIDocument* aDocument, nsIContentSecurityPolicy** aCSP) override;
|
2015-05-12 00:36:56 +03:00
|
|
|
NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
|
2016-11-06 08:38:17 +03:00
|
|
|
NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
|
2015-05-12 00:36:56 +03:00
|
|
|
|
2016-08-30 07:22:04 +03:00
|
|
|
virtual nsresult GetScriptLocation(nsACString &aStr) override;
|
2012-03-09 13:48:50 +04:00
|
|
|
|
2018-09-11 12:01:14 +03:00
|
|
|
nsresult GetSiteIdentifier(SiteIdentifier& aSite) override {
|
|
|
|
aSite.Init(this);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2003-10-22 02:11:49 +04:00
|
|
|
protected:
|
2017-03-22 13:39:08 +03:00
|
|
|
virtual ~SystemPrincipal(void) {}
|
2015-05-14 21:15:56 +03:00
|
|
|
|
2017-03-22 13:39:08 +03:00
|
|
|
bool SubsumesInternal(nsIPrincipal *aOther,
|
|
|
|
DocumentDomainConsideration aConsideration) override
|
2015-05-14 21:15:56 +03:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2015-10-01 06:03:36 +03:00
|
|
|
|
|
|
|
bool MayLoadInternal(nsIURI* aURI) override
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
1999-09-01 04:54:35 +04:00
|
|
|
};
|
|
|
|
|
2018-07-17 22:38:19 +03:00
|
|
|
} // mozilla namespace
|
|
|
|
|
|
|
|
#endif // mozilla_SystemPrincipal_h
|