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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nsGlobalWindowInner::GetPrincipalHashValue() const {
|
|
||||||
if (mDoc) {
|
|
||||||
return mDoc->NodePrincipal()->GetHashValue();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
mozilla::Result<mozilla::ipc::PrincipalInfo, nsresult>
|
mozilla::Result<mozilla::ipc::PrincipalInfo, nsresult>
|
||||||
nsGlobalWindowInner::GetStorageKey() {
|
nsGlobalWindowInner::GetStorageKey() {
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|||||||
@@ -248,7 +248,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
|
|||||||
|
|
||||||
// nsIGlobalObject
|
// nsIGlobalObject
|
||||||
bool ShouldResistFingerprinting() const final;
|
bool ShouldResistFingerprinting() const final;
|
||||||
uint32_t GetPrincipalHashValue() const final;
|
|
||||||
mozilla::OriginTrials Trials() const final;
|
mozilla::OriginTrials Trials() const final;
|
||||||
mozilla::dom::FontFaceSet* Fonts() 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");
|
"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 {
|
OriginTrials nsGlobalWindowOuter::Trials() const {
|
||||||
return mInnerWindow ? nsGlobalWindowInner::Cast(mInnerWindow)->Trials()
|
return mInnerWindow ? nsGlobalWindowInner::Cast(mInnerWindow)->Trials()
|
||||||
: OriginTrials();
|
: OriginTrials();
|
||||||
|
|||||||
@@ -234,7 +234,6 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
|
|||||||
|
|
||||||
// nsIGlobalObject
|
// nsIGlobalObject
|
||||||
bool ShouldResistFingerprinting() const final;
|
bool ShouldResistFingerprinting() const final;
|
||||||
uint32_t GetPrincipalHashValue() const final;
|
|
||||||
mozilla::OriginTrials Trials() const final;
|
mozilla::OriginTrials Trials() const final;
|
||||||
mozilla::dom::FontFaceSet* Fonts() final;
|
mozilla::dom::FontFaceSet* Fonts() final;
|
||||||
|
|
||||||
|
|||||||
@@ -394,12 +394,8 @@ mozilla::Result<bool, nsresult> nsIGlobalObject::HasEqualStorageKey(
|
|||||||
return mozilla::ipc::StorageKeysEqual(storageKey, aStorageKey);
|
return mozilla::ipc::StorageKeysEqual(storageKey, aStorageKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsIGlobalObject::IsSystemPrincipal() const {
|
|
||||||
return PrincipalOrNull()->IsSystemPrincipal();
|
|
||||||
}
|
|
||||||
|
|
||||||
RTPCallerType nsIGlobalObject::GetRTPCallerType() const {
|
RTPCallerType nsIGlobalObject::GetRTPCallerType() const {
|
||||||
if (IsSystemPrincipal()) {
|
if (PrincipalOrNull()->IsSystemPrincipal()) {
|
||||||
return RTPCallerType::SystemPrincipal;
|
return RTPCallerType::SystemPrincipal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -258,12 +258,6 @@ class nsIGlobalObject : public nsISupports,
|
|||||||
|
|
||||||
RTPCallerType GetRTPCallerType() const;
|
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
|
* Get the module loader to use for this global, if any. By default this
|
||||||
* returns null.
|
* returns null.
|
||||||
@@ -284,8 +278,6 @@ class nsIGlobalObject : public nsISupports,
|
|||||||
protected:
|
protected:
|
||||||
virtual ~nsIGlobalObject();
|
virtual ~nsIGlobalObject();
|
||||||
|
|
||||||
virtual bool IsSystemPrincipal() const;
|
|
||||||
|
|
||||||
void StartDying() { mIsDying = true; }
|
void StartDying() { mIsDying = true; }
|
||||||
|
|
||||||
void StartForbiddingScript() { mIsScriptForbidden = true; }
|
void StartForbiddingScript() { mIsScriptForbidden = true; }
|
||||||
|
|||||||
@@ -5678,7 +5678,10 @@ uint32_t ClientWebGLContext::GetPrincipalHashValue() const {
|
|||||||
if (mOffscreenCanvas) {
|
if (mOffscreenCanvas) {
|
||||||
nsIGlobalObject* global = mOffscreenCanvas->GetOwnerGlobal();
|
nsIGlobalObject* global = mOffscreenCanvas->GetOwnerGlobal();
|
||||||
if (global) {
|
if (global) {
|
||||||
return global->GetPrincipalHashValue();
|
nsIPrincipal* principal = global->PrincipalOrNull();
|
||||||
|
if (principal) {
|
||||||
|
return principal->GetHashValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -772,10 +772,6 @@ class WorkerPrivate final
|
|||||||
return *mLoadInfo.mPartitionedPrincipalInfo;
|
return *mLoadInfo.mPartitionedPrincipalInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t GetPrincipalHashValue() const {
|
|
||||||
return GetPrincipal()->GetHashValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
const mozilla::ipc::PrincipalInfo& GetEffectiveStoragePrincipalInfo() const;
|
const mozilla::ipc::PrincipalInfo& GetEffectiveStoragePrincipalInfo() const;
|
||||||
|
|
||||||
already_AddRefed<nsIChannel> ForgetWorkerChannel() {
|
already_AddRefed<nsIChannel> ForgetWorkerChannel() {
|
||||||
|
|||||||
@@ -275,15 +275,6 @@ bool WorkerGlobalScopeBase::ShouldResistFingerprinting() const {
|
|||||||
return mShouldResistFingerprinting;
|
return mShouldResistFingerprinting;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorkerGlobalScopeBase::IsSystemPrincipal() const {
|
|
||||||
return mWorkerPrivate->UsesSystemPrincipal();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t WorkerGlobalScopeBase::GetPrincipalHashValue() const {
|
|
||||||
AssertIsOnWorkerThread();
|
|
||||||
return mWorkerPrivate->GetPrincipalHashValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
OriginTrials WorkerGlobalScopeBase::Trials() const {
|
OriginTrials WorkerGlobalScopeBase::Trials() const {
|
||||||
AssertIsOnWorkerThread();
|
AssertIsOnWorkerThread();
|
||||||
return mWorkerPrivate->Trials();
|
return mWorkerPrivate->Trials();
|
||||||
|
|||||||
@@ -120,8 +120,6 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
|
|||||||
|
|
||||||
bool ShouldResistFingerprinting() const final;
|
bool ShouldResistFingerprinting() const final;
|
||||||
|
|
||||||
uint32_t GetPrincipalHashValue() const final;
|
|
||||||
|
|
||||||
OriginTrials Trials() const final;
|
OriginTrials Trials() const final;
|
||||||
|
|
||||||
StorageAccess GetStorageAccess() final;
|
StorageAccess GetStorageAccess() final;
|
||||||
@@ -174,8 +172,6 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
|
|||||||
protected:
|
protected:
|
||||||
~WorkerGlobalScopeBase();
|
~WorkerGlobalScopeBase();
|
||||||
|
|
||||||
bool IsSystemPrincipal() const final;
|
|
||||||
|
|
||||||
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
|
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
|
||||||
|
|
||||||
void AssertIsOnWorkerThread() const {
|
void AssertIsOnWorkerThread() const {
|
||||||
|
|||||||
@@ -76,10 +76,6 @@ bool WorkletGlobalScope::ShouldResistFingerprinting() const {
|
|||||||
return mImpl->ShouldResistFingerprinting();
|
return mImpl->ShouldResistFingerprinting();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorkletGlobalScope::IsSystemPrincipal() const {
|
|
||||||
return mImpl->IsSystemPrincipal();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorkletGlobalScope::Dump(const Optional<nsAString>& aString) const {
|
void WorkletGlobalScope::Dump(const Optional<nsAString>& aString) const {
|
||||||
WorkletThread::AssertIsOnWorkletThread();
|
WorkletThread::AssertIsOnWorkletThread();
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,6 @@ class WorkletGlobalScope : public nsIGlobalObject, public nsWrapperCache {
|
|||||||
protected:
|
protected:
|
||||||
~WorkletGlobalScope();
|
~WorkletGlobalScope();
|
||||||
|
|
||||||
bool IsSystemPrincipal() const override;
|
|
||||||
|
|
||||||
const RefPtr<WorkletImpl> mImpl;
|
const RefPtr<WorkletImpl> mImpl;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user