2015-05-11 21:36:56 +00: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 11:12:37 +00: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-11 22:10:36 +00:00
|
|
|
|
1999-09-01 00:54:35 +00:00
|
|
|
/* The privileged system principal. */
|
1999-11-11 22:10:36 +00:00
|
|
|
|
2018-07-17 19:38:19 +00:00
|
|
|
#ifndef mozilla_SystemPrincipal_h
|
|
|
|
#define mozilla_SystemPrincipal_h
|
1999-09-01 00:54:35 +00:00
|
|
|
|
2003-10-21 22:11:49 +00:00
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "nsJSPrincipals.h"
|
1999-09-01 00:54:35 +00:00
|
|
|
|
2015-05-11 21:36:56 +00:00
|
|
|
#include "mozilla/BasePrincipal.h"
|
|
|
|
|
1999-09-01 00:54:35 +00:00
|
|
|
#define NS_SYSTEMPRINCIPAL_CID \
|
2018-11-30 10:46:48 +00:00
|
|
|
{ \
|
2000-01-06 00:59:18 +00:00
|
|
|
0x4a6212db, 0xaccb, 0x11d3, { \
|
|
|
|
0xb7, 0x65, 0x0, 0x60, 0xb0, 0xb6, 0xce, 0xcb \
|
|
|
|
} \
|
2018-11-30 10:46:48 +00:00
|
|
|
}
|
2001-07-31 19:05:34 +00:00
|
|
|
#define NS_SYSTEMPRINCIPAL_CONTRACTID "@mozilla.org/systemprincipal;1"
|
2000-01-06 00:59:18 +00:00
|
|
|
|
2019-06-03 12:37:12 +00:00
|
|
|
namespace Json {
|
|
|
|
class Value;
|
|
|
|
}
|
|
|
|
|
2018-07-17 19:38:19 +00:00
|
|
|
namespace mozilla {
|
1999-09-01 00:54:35 +00:00
|
|
|
|
2018-07-17 19:38:19 +00:00
|
|
|
class SystemPrincipal final : public BasePrincipal {
|
2017-02-24 22:02:24 +00:00
|
|
|
SystemPrincipal() : BasePrincipal(eSystemPrincipal) {}
|
|
|
|
|
1999-09-01 00:54:35 +00:00
|
|
|
public:
|
2017-03-22 10:39:08 +00:00
|
|
|
static already_AddRefed<SystemPrincipal> Create();
|
2017-02-24 22:02:24 +00:00
|
|
|
|
2017-04-16 20:32:42 +00:00
|
|
|
static PrincipalKind Kind() { return eSystemPrincipal; }
|
|
|
|
|
2015-05-11 21:36:56 +00:00
|
|
|
NS_DECL_NSISERIALIZABLE
|
|
|
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
|
2018-11-20 01:17:52 +00:00
|
|
|
uint32_t GetHashValue() override;
|
2015-05-11 21:36:56 +00:00
|
|
|
NS_IMETHOD GetURI(nsIURI** aURI) override;
|
|
|
|
NS_IMETHOD GetDomain(nsIURI** aDomain) override;
|
|
|
|
NS_IMETHOD SetDomain(nsIURI* aDomain) override;
|
|
|
|
NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
|
2016-11-06 05:38:17 +00:00
|
|
|
NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
|
2015-05-11 21:36:56 +00:00
|
|
|
|
2016-08-30 04:22:04 +00:00
|
|
|
virtual nsresult GetScriptLocation(nsACString& aStr) override;
|
2012-03-09 09:48:50 +00:00
|
|
|
|
2018-09-11 09:01:14 +00:00
|
|
|
nsresult GetSiteIdentifier(SiteIdentifier& aSite) override {
|
|
|
|
aSite.Init(this);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2003-10-21 22:11:49 +00:00
|
|
|
protected:
|
2017-03-22 10:39:08 +00:00
|
|
|
virtual ~SystemPrincipal(void) {}
|
2015-05-14 18:15:56 +00:00
|
|
|
|
2017-03-22 10:39:08 +00:00
|
|
|
bool SubsumesInternal(nsIPrincipal* aOther,
|
|
|
|
DocumentDomainConsideration aConsideration) override {
|
2015-05-14 18:15:56 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-10-01 03:03:36 +00:00
|
|
|
|
|
|
|
bool MayLoadInternal(nsIURI* aURI) override { return true; }
|
1999-09-01 00:54:35 +00:00
|
|
|
};
|
|
|
|
|
2018-07-17 19:38:19 +00:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_SystemPrincipal_h
|