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-28 04:21:26 +00:00
Родитель a1dd535147
Коммит e77e364a98
4 изменённых файлов: 12 добавлений и 0 удалений

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

@ -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();

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

@ -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();

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

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

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

@ -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;
};