tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit ede104feef5622371ff797a22dc2bb465627b808
parent 807aac08ca3a1900275037f54d5af41f162e938a
Author: Manuel Bucher <manuel@mozilla.com>
Date:   Wed, 29 Oct 2025 14:26:43 +0000

Bug 1992207 - Storage-Access-Headers: Remove unnecessary wc->SetUsingStorageAccess r=timhuang

Just setting the loadInfo introduced in Bug 1991888 is enough.
Not setting the bit is good for performance due to sending less data
over IPC.

Differential Revision: https://phabricator.services.mozilla.com/D269730

Diffstat:
Mdocshell/base/WindowContext.cpp | 10+---------
Mdocshell/base/WindowContext.h | 1-
Mtoolkit/components/antitracking/AntiTrackingUtils.cpp | 13-------------
3 files changed, 1 insertion(+), 23 deletions(-)

diff --git a/docshell/base/WindowContext.cpp b/docshell/base/WindowContext.cpp @@ -277,15 +277,7 @@ bool WindowContext::CanSet(FieldIndex<IDX_IsThirdPartyTrackingResourceWindow>, bool WindowContext::CanSet(FieldIndex<IDX_UsingStorageAccess>, const bool& aUsingStorageAccess, ContentParent* aSource) { - return XRE_IsParentProcess() || CheckOnlyOwningProcessCanSet(aSource); -} - -void WindowContext::DidSet(FieldIndex<IDX_UsingStorageAccess>, bool aOldValue) { - if (!aOldValue && GetUsingStorageAccess() && XRE_IsContentProcess()) { - if (nsGlobalWindowInner* windowInner = GetInnerWindow()) { - windowInner->StorageAccessPermissionChanged(true); - } - } + return CheckOnlyOwningProcessCanSet(aSource); } bool WindowContext::CanSet(FieldIndex<IDX_ShouldResistFingerprinting>, diff --git a/docshell/base/WindowContext.h b/docshell/base/WindowContext.h @@ -313,7 +313,6 @@ class WindowContext : public nsISupports, public nsWrapperCache { ContentParent* aSource); bool CanSet(FieldIndex<IDX_UsingStorageAccess>, const bool& aUsingStorageAccess, ContentParent* aSource); - void DidSet(FieldIndex<IDX_UsingStorageAccess>, bool aOldValue); bool CanSet(FieldIndex<IDX_ShouldResistFingerprinting>, const bool& aShouldResistFingerprinting, ContentParent* aSource); bool CanSet(FieldIndex<IDX_OverriddenFingerprintingSettings>, diff --git a/toolkit/components/antitracking/AntiTrackingUtils.cpp b/toolkit/components/antitracking/AntiTrackingUtils.cpp @@ -699,17 +699,6 @@ nsresult AntiTrackingUtils::ActivateStoragePermissionStateInParent( return NS_ERROR_FAILURE; } - RefPtr<BrowsingContext> bc; - nsresult rv = loadInfo->GetTargetBrowsingContext(getter_AddRefs(bc)); - if (NS_WARN_IF(NS_FAILED(rv)) || !bc) { - return NS_ERROR_FAILURE; - } - - WindowContext* wc = bc->GetCurrentWindowContext(); - if (NS_WARN_IF(!wc)) { - return NS_ERROR_FAILURE; - } - #ifdef DEBUG // We are only allowed to transition from "Inactive" to "Has". Parent function // should check this condition, but check here again to make extra sure. @@ -720,8 +709,6 @@ nsresult AntiTrackingUtils::ActivateStoragePermissionStateInParent( // Allow accessing unpartitioned cookies MOZ_TRY(loadInfo->SetStoragePermission(nsILoadInfo::HasStoragePermission)); - MOZ_TRY(wc->SetUsingStorageAccess(true)); - return NS_OK; }