Bug 1673931 - Avoid including ChromeUtils.h from header files.

Differential Revision: https://phabricator.services.mozilla.com/D96553

Depends on D96552
This commit is contained in:
Simon Giesecke 2020-11-23 16:10:16 +00:00
parent 0a3ad2063b
commit 1000a339cf
3 changed files with 38 additions and 29 deletions

View File

@ -323,6 +323,19 @@ nsresult BasePrincipal::ToJSON(nsACString& aResult) {
return NS_OK;
}
bool BasePrincipal::FastSubsumesIgnoringFPD(
nsIPrincipal* aOther, DocumentDomainConsideration aConsideration) {
MOZ_ASSERT(aOther);
if (Kind() == eContentPrincipal &&
!dom::ChromeUtils::IsOriginAttributesEqualIgnoringFPD(
mOriginAttributes, Cast(aOther)->mOriginAttributes)) {
return false;
}
return SubsumesInternal(aOther, aConsideration);
}
bool BasePrincipal::Subsumes(nsIPrincipal* aOther,
DocumentDomainConsideration aConsideration) {
MOZ_ASSERT(aOther);

View File

@ -7,26 +7,36 @@
#ifndef mozilla_BasePrincipal_h
#define mozilla_BasePrincipal_h
#include "nsJSPrincipals.h"
#include "mozilla/Attributes.h"
#include <stdint.h>
#include "ErrorList.h"
#include "js/RootingAPI.h"
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Assertions.h"
#include "mozilla/OriginAttributes.h"
class nsAtom;
class nsIContentSecurityPolicy;
class nsIObjectOutputStream;
class nsIObjectInputStream;
class nsIURI;
#include "mozilla/RefPtr.h"
#include "mozilla/dom/ReferrerPolicyBinding.h"
#include "nsAtom.h"
#include "nsIPrincipal.h"
#include "nsJSPrincipals.h"
#include "nsStringFwd.h"
#include "nscore.h"
class ExpandedPrincipal;
class mozIDOMWindow;
class nsIChannel;
class nsIReferrerInfo;
class nsISupports;
class nsIURI;
namespace JS {
class Value;
}
namespace Json {
class Value;
}
struct JSContext;
namespace mozilla {
namespace dom {
class Document;
}
namespace extensions {
class WebExtensionPolicy;
}
@ -321,8 +331,8 @@ class BasePrincipal : public nsJSPrincipals {
nsIURI* aURI, const OriginAttributes& aAttrs,
const nsACString& aOriginNoSuffix);
inline bool FastSubsumesIgnoringFPD(
nsIPrincipal* aOther, DocumentDomainConsideration aConsideration);
bool FastSubsumesIgnoringFPD(nsIPrincipal* aOther,
DocumentDomainConsideration aConsideration);
RefPtr<nsAtom> mOriginNoSuffix;
RefPtr<nsAtom> mOriginSuffix;
@ -397,19 +407,6 @@ inline bool BasePrincipal::FastSubsumesConsideringDomain(nsIPrincipal* aOther) {
return Subsumes(aOther, ConsiderDocumentDomain);
}
inline bool BasePrincipal::FastSubsumesIgnoringFPD(
nsIPrincipal* aOther, DocumentDomainConsideration aConsideration) {
MOZ_ASSERT(aOther);
if (Kind() == eContentPrincipal &&
!dom::ChromeUtils::IsOriginAttributesEqualIgnoringFPD(
mOriginAttributes, Cast(aOther)->mOriginAttributes)) {
return false;
}
return SubsumesInternal(aOther, aConsideration);
}
inline bool BasePrincipal::FastSubsumesIgnoringFPD(nsIPrincipal* aOther) {
return FastSubsumesIgnoringFPD(aOther, DontConsiderDocumentDomain);
}

View File

@ -7,7 +7,6 @@
#ifndef mozilla_OriginAttributes_h
#define mozilla_OriginAttributes_h
#include "mozilla/dom/ChromeUtils.h"
#include "mozilla/dom/ChromeUtilsBinding.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "nsIScriptSecurityManager.h"