Bug 1778510: Add a ShouldRFP boolean to Worklets r=asuth

This will be needed when we set the Javascript Realm options
for Worklets.

Depends on D151283

Differential Revision: https://phabricator.services.mozilla.com/D151297
This commit is contained in:
Tom Ritter 2022-11-29 13:34:13 +00:00
parent ed527a4716
commit 7b33d514fe
4 changed files with 12 additions and 0 deletions

View File

@ -72,6 +72,10 @@ bool WorkletGlobalScope::IsSharedMemoryAllowed() const {
return mImpl->IsSharedMemoryAllowed();
}
bool WorkletGlobalScope::ShouldResistFingerprinting() const {
return mImpl->ShouldResistFingerprinting();
}
void WorkletGlobalScope::Dump(const Optional<nsAString>& aString) const {
WorkletThread::AssertIsOnWorkletThread();

View File

@ -68,6 +68,7 @@ class WorkletGlobalScope : public nsIGlobalObject, public nsWrapperCache {
OriginTrials Trials() const override;
Maybe<nsID> GetAgentClusterId() const override;
bool IsSharedMemoryAllowed() const override;
bool ShouldResistFingerprinting() const override;
protected:
~WorkletGlobalScope();

View File

@ -52,6 +52,9 @@ WorkletImpl::WorkletImpl(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal)
mSharedMemoryAllowed =
nsGlobalWindowInner::Cast(aWindow)->IsSharedMemoryAllowed();
mShouldResistFingerprinting =
aWindow->AsGlobal()->ShouldResistFingerprinting();
}
WorkletImpl::~WorkletImpl() {

View File

@ -82,6 +82,9 @@ class WorkletImpl {
const Maybe<nsID>& GetAgentClusterId() const { return mAgentClusterId; }
bool IsSharedMemoryAllowed() const { return mSharedMemoryAllowed; }
bool ShouldResistFingerprinting() const {
return mShouldResistFingerprinting;
}
virtual void OnAddModuleStarted() const {
MOZ_ASSERT(NS_IsMainThread());
@ -117,6 +120,7 @@ class WorkletImpl {
Maybe<nsID> mAgentClusterId;
bool mSharedMemoryAllowed;
bool mShouldResistFingerprinting;
const OriginTrials mTrials;
};