Bug 1778510: Move shouldRFP from WorkerPrivate to WorkerGlobalScopeBase r=asuth

This does not remove mShouldResistFingerprinting from
WorkerPrivate->mLoadInfo.  This is because in between
mLoadInfo getting initialized (including where shouldRFP gets
set) and when the worker's global scope is constructed, we
need to keep track of whether we shouldRFP or not.  We could
make this single bool an outparam of GetLoadInfo to later
pass to GetOrCreateGlobalScope, but that seems noisy.

Differential Revision: https://phabricator.services.mozilla.com/D157563
This commit is contained in:
Tom Ritter
2022-11-29 13:34:12 +00:00
parent e8aba69e01
commit ef693d4e6e
4 changed files with 37 additions and 25 deletions

View File

@@ -98,7 +98,8 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
DOMEventTargetHelper)
WorkerGlobalScopeBase(WorkerPrivate* aWorkerPrivate,
UniquePtr<ClientSource> aClientSource);
UniquePtr<ClientSource> aClientSource,
bool mShouldResistFingerprinting);
virtual bool WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector) = 0;
@@ -182,6 +183,7 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
RefPtr<Console> mConsole;
const UniquePtr<ClientSource> mClientSource;
nsCOMPtr<nsISerialEventTarget> mSerialEventTarget;
bool mShouldResistFingerprinting;
#ifdef DEBUG
PRThread* mWorkerThreadUsedOnlyForAssert;
#endif
@@ -374,7 +376,8 @@ class DedicatedWorkerGlobalScope final
DedicatedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
UniquePtr<ClientSource> aClientSource,
const nsString& aName);
const nsString& aName,
bool aShouldResistFingerprinting);
bool WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector) override;
@@ -418,7 +421,8 @@ class SharedWorkerGlobalScope final
public:
SharedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
UniquePtr<ClientSource> aClientSource,
const nsString& aName);
const nsString& aName,
bool aShouldResistFingerprinting);
bool WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector) override;
@@ -439,7 +443,8 @@ class ServiceWorkerGlobalScope final : public WorkerGlobalScope {
ServiceWorkerGlobalScope(
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource,
const ServiceWorkerRegistrationDescriptor& aRegistrationDescriptor);
const ServiceWorkerRegistrationDescriptor& aRegistrationDescriptor,
bool aShouldResistFingerprinting);
bool WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector) override;