Bug 1818250 - Add ShouldResistFingerprinting to WindowContext. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D172271
This commit is contained in:
Tom Schuster 2023-03-20 18:52:25 +00:00
Родитель d996ac6376
Коммит 2536630f8b
4 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -227,6 +227,12 @@ bool WindowContext::CanSet(FieldIndex<IDX_IsThirdPartyTrackingResourceWindow>,
return CheckOnlyOwningProcessCanSet(aSource);
}
bool WindowContext::CanSet(FieldIndex<IDX_ShouldResistFingerprinting>,
const bool& aShouldResistFingerprinting,
ContentParent* aSource) {
return CheckOnlyOwningProcessCanSet(aSource);
}
bool WindowContext::CanSet(FieldIndex<IDX_IsSecureContext>,
const bool& aIsSecureContext,
ContentParent* aSource) {

Просмотреть файл

@ -51,6 +51,7 @@ class BrowsingContextGroup;
/* Whether this window's channel has been marked as a third-party \
* tracking resource */ \
FIELD(IsThirdPartyTrackingResourceWindow, bool) \
FIELD(ShouldResistFingerprinting, bool) \
FIELD(IsSecureContext, bool) \
FIELD(IsOriginalFrameSource, bool) \
/* Mixed-Content: If the corresponding documentURI is https, \
@ -127,6 +128,10 @@ class WindowContext : public nsISupports, public nsWrapperCache {
bool IsLocalIP() const { return GetIsLocalIP(); }
bool ShouldResistFingerprinting() const {
return GetShouldResistFingerprinting();
}
nsGlobalWindowInner* GetInnerWindow() const;
Document* GetDocument() const;
Document* GetExtantDoc() const;
@ -261,6 +266,8 @@ class WindowContext : public nsISupports, public nsWrapperCache {
bool CanSet(FieldIndex<IDX_IsThirdPartyTrackingResourceWindow>,
const bool& aIsThirdPartyTrackingResourceWindow,
ContentParent* aSource);
bool CanSet(FieldIndex<IDX_ShouldResistFingerprinting>,
const bool& aShouldResistFingerprinting, ContentParent* aSource);
bool CanSet(FieldIndex<IDX_IsSecureContext>, const bool& aIsSecureContext,
ContentParent* aSource);
bool CanSet(FieldIndex<IDX_IsOriginalFrameSource>,

Просмотреть файл

@ -32,6 +32,8 @@ interface WindowContext {
// True if the principal of this window is for a local ip address.
readonly attribute boolean isLocalIP;
readonly attribute boolean shouldResistFingerprinting;
/**
* Partially determines whether script execution is allowed in this
* BrowsingContext. Script execution will be permitted only if this

Просмотреть файл

@ -100,6 +100,7 @@ WindowGlobalInit WindowGlobalActor::WindowInitializer(
fields.mIsThirdPartyWindow = doc->HasThirdPartyChannel();
fields.mIsThirdPartyTrackingResourceWindow =
nsContentUtils::IsThirdPartyTrackingResourceWindow(aWindow);
fields.mShouldResistFingerprinting = doc->ShouldResistFingerprinting();
fields.mIsSecureContext = aWindow->IsSecureContext();
// Initialze permission fields