зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1517434 part 1. Add a fast inline nsIPrincipal::IsSystemPrincipal. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D15672 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
eb4ba6cb0e
Коммит
2c0124d662
|
@ -266,7 +266,7 @@ BasePrincipal::GetIsExpandedPrincipal(bool* aResult) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::GetIsSystemPrincipal(bool* aResult) {
|
||||
*aResult = Kind() == eSystemPrincipal;
|
||||
*aResult = IsSystemPrincipal();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,6 +134,10 @@ class BasePrincipal : public nsJSPrincipals {
|
|||
return static_cast<BasePrincipal*>(aPrin);
|
||||
}
|
||||
|
||||
static const BasePrincipal* Cast(const nsIPrincipal* aPrin) {
|
||||
return static_cast<const BasePrincipal*>(aPrin);
|
||||
}
|
||||
|
||||
static already_AddRefed<BasePrincipal> CreateCodebasePrincipal(
|
||||
const nsACString& aOrigin);
|
||||
|
||||
|
@ -179,6 +183,9 @@ class BasePrincipal : public nsJSPrincipals {
|
|||
inline bool FastSubsumesIgnoringFPD(nsIPrincipal* aOther);
|
||||
inline bool FastSubsumesConsideringDomainIgnoringFPD(nsIPrincipal* aOther);
|
||||
|
||||
// Fast way to check whether we have a system principal.
|
||||
inline bool IsSystemPrincipal() const;
|
||||
|
||||
// Returns the principal to inherit when a caller with this principal loads
|
||||
// the given URI.
|
||||
//
|
||||
|
@ -342,6 +349,14 @@ inline bool BasePrincipal::FastSubsumesConsideringDomainIgnoringFPD(
|
|||
return FastSubsumesIgnoringFPD(aOther, ConsiderDocumentDomain);
|
||||
}
|
||||
|
||||
inline bool BasePrincipal::IsSystemPrincipal() const {
|
||||
return Kind() == eSystemPrincipal;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
inline bool nsIPrincipal::IsSystemPrincipal() const {
|
||||
return mozilla::BasePrincipal::Cast(this)->IsSystemPrincipal();
|
||||
}
|
||||
|
||||
#endif /* mozilla_BasePrincipal_h */
|
||||
|
|
|
@ -335,6 +335,14 @@ interface nsIPrincipal : nsISerializable
|
|||
*/
|
||||
[infallible] readonly attribute boolean isSystemPrincipal;
|
||||
|
||||
/**
|
||||
* Faster and nicer version callable from C++. Callers must include
|
||||
* BasePrincipal.h, where it's implemented.
|
||||
*/
|
||||
%{C++
|
||||
inline bool IsSystemPrincipal() const;
|
||||
%}
|
||||
|
||||
/**
|
||||
* Returns true iff the principal is either an addon principal or
|
||||
* an expanded principal, which contains at least one addon principal.
|
||||
|
|
Загрузка…
Ссылка в новой задаче