Bug 1806709 - Part 2: Clean up some trivial nsIPrincipal helper methods from nsIGlobalObject, r=asuth
These methods only existed because nsIGlobalObject::PrincipalOrNull was not available off-main-thread, so can now be removed. Depends on D165198 Differential Revision: https://phabricator.services.mozilla.com/D165199
This commit is contained in:
@@ -1647,13 +1647,6 @@ FontFaceSet* nsGlobalWindowInner::Fonts() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t nsGlobalWindowInner::GetPrincipalHashValue() const {
|
||||
if (mDoc) {
|
||||
return mDoc->NodePrincipal()->GetHashValue();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
mozilla::Result<mozilla::ipc::PrincipalInfo, nsresult>
|
||||
nsGlobalWindowInner::GetStorageKey() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@@ -248,7 +248,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
|
||||
|
||||
// nsIGlobalObject
|
||||
bool ShouldResistFingerprinting() const final;
|
||||
uint32_t GetPrincipalHashValue() const final;
|
||||
mozilla::OriginTrials Trials() const final;
|
||||
mozilla::dom::FontFaceSet* Fonts() final;
|
||||
|
||||
|
||||
@@ -1672,13 +1672,6 @@ bool nsGlobalWindowOuter::ShouldResistFingerprinting() const {
|
||||
"to make an informed RFP choice, so we fall back to the global pref");
|
||||
}
|
||||
|
||||
uint32_t nsGlobalWindowOuter::GetPrincipalHashValue() const {
|
||||
if (mDoc) {
|
||||
return mDoc->NodePrincipal()->GetHashValue();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
OriginTrials nsGlobalWindowOuter::Trials() const {
|
||||
return mInnerWindow ? nsGlobalWindowInner::Cast(mInnerWindow)->Trials()
|
||||
: OriginTrials();
|
||||
|
||||
@@ -234,7 +234,6 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
|
||||
|
||||
// nsIGlobalObject
|
||||
bool ShouldResistFingerprinting() const final;
|
||||
uint32_t GetPrincipalHashValue() const final;
|
||||
mozilla::OriginTrials Trials() const final;
|
||||
mozilla::dom::FontFaceSet* Fonts() final;
|
||||
|
||||
|
||||
@@ -394,12 +394,8 @@ mozilla::Result<bool, nsresult> nsIGlobalObject::HasEqualStorageKey(
|
||||
return mozilla::ipc::StorageKeysEqual(storageKey, aStorageKey);
|
||||
}
|
||||
|
||||
bool nsIGlobalObject::IsSystemPrincipal() const {
|
||||
return PrincipalOrNull()->IsSystemPrincipal();
|
||||
}
|
||||
|
||||
RTPCallerType nsIGlobalObject::GetRTPCallerType() const {
|
||||
if (IsSystemPrincipal()) {
|
||||
if (PrincipalOrNull()->IsSystemPrincipal()) {
|
||||
return RTPCallerType::SystemPrincipal;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,12 +258,6 @@ class nsIGlobalObject : public nsISupports,
|
||||
|
||||
RTPCallerType GetRTPCallerType() const;
|
||||
|
||||
/**
|
||||
* Threadsafe way to get nsIPrincipal::GetHashValue for the associated
|
||||
* principal.
|
||||
*/
|
||||
virtual uint32_t GetPrincipalHashValue() const { return 0; }
|
||||
|
||||
/**
|
||||
* Get the module loader to use for this global, if any. By default this
|
||||
* returns null.
|
||||
@@ -284,8 +278,6 @@ class nsIGlobalObject : public nsISupports,
|
||||
protected:
|
||||
virtual ~nsIGlobalObject();
|
||||
|
||||
virtual bool IsSystemPrincipal() const;
|
||||
|
||||
void StartDying() { mIsDying = true; }
|
||||
|
||||
void StartForbiddingScript() { mIsScriptForbidden = true; }
|
||||
|
||||
@@ -5678,7 +5678,10 @@ uint32_t ClientWebGLContext::GetPrincipalHashValue() const {
|
||||
if (mOffscreenCanvas) {
|
||||
nsIGlobalObject* global = mOffscreenCanvas->GetOwnerGlobal();
|
||||
if (global) {
|
||||
return global->GetPrincipalHashValue();
|
||||
nsIPrincipal* principal = global->PrincipalOrNull();
|
||||
if (principal) {
|
||||
return principal->GetHashValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -772,10 +772,6 @@ class WorkerPrivate final
|
||||
return *mLoadInfo.mPartitionedPrincipalInfo;
|
||||
}
|
||||
|
||||
uint32_t GetPrincipalHashValue() const {
|
||||
return GetPrincipal()->GetHashValue();
|
||||
}
|
||||
|
||||
const mozilla::ipc::PrincipalInfo& GetEffectiveStoragePrincipalInfo() const;
|
||||
|
||||
already_AddRefed<nsIChannel> ForgetWorkerChannel() {
|
||||
|
||||
@@ -275,15 +275,6 @@ bool WorkerGlobalScopeBase::ShouldResistFingerprinting() const {
|
||||
return mShouldResistFingerprinting;
|
||||
}
|
||||
|
||||
bool WorkerGlobalScopeBase::IsSystemPrincipal() const {
|
||||
return mWorkerPrivate->UsesSystemPrincipal();
|
||||
}
|
||||
|
||||
uint32_t WorkerGlobalScopeBase::GetPrincipalHashValue() const {
|
||||
AssertIsOnWorkerThread();
|
||||
return mWorkerPrivate->GetPrincipalHashValue();
|
||||
}
|
||||
|
||||
OriginTrials WorkerGlobalScopeBase::Trials() const {
|
||||
AssertIsOnWorkerThread();
|
||||
return mWorkerPrivate->Trials();
|
||||
|
||||
@@ -120,8 +120,6 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
|
||||
|
||||
bool ShouldResistFingerprinting() const final;
|
||||
|
||||
uint32_t GetPrincipalHashValue() const final;
|
||||
|
||||
OriginTrials Trials() const final;
|
||||
|
||||
StorageAccess GetStorageAccess() final;
|
||||
@@ -174,8 +172,6 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
|
||||
protected:
|
||||
~WorkerGlobalScopeBase();
|
||||
|
||||
bool IsSystemPrincipal() const final;
|
||||
|
||||
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
|
||||
|
||||
void AssertIsOnWorkerThread() const {
|
||||
|
||||
@@ -76,10 +76,6 @@ bool WorkletGlobalScope::ShouldResistFingerprinting() const {
|
||||
return mImpl->ShouldResistFingerprinting();
|
||||
}
|
||||
|
||||
bool WorkletGlobalScope::IsSystemPrincipal() const {
|
||||
return mImpl->IsSystemPrincipal();
|
||||
}
|
||||
|
||||
void WorkletGlobalScope::Dump(const Optional<nsAString>& aString) const {
|
||||
WorkletThread::AssertIsOnWorkletThread();
|
||||
|
||||
|
||||
@@ -73,8 +73,6 @@ class WorkletGlobalScope : public nsIGlobalObject, public nsWrapperCache {
|
||||
protected:
|
||||
~WorkletGlobalScope();
|
||||
|
||||
bool IsSystemPrincipal() const override;
|
||||
|
||||
const RefPtr<WorkletImpl> mImpl;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user