tor-browser

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

commit 2f46993c8fe60bb5ca5e600dc7e1340f29d834fc
parent ecbfaf8159aec595013ce3edefb2be7af747a114
Author: Manuel Bucher <manuel@mozilla.com>
Date:   Thu,  2 Oct 2025 13:18:22 +0000

Bug 1991888 - Storage-Access-Headers: fix "Activate-Storage-Access: load" r=timhuang

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

Diffstat:
Mtesting/web-platform/meta/storage-access-api/storage-access-headers.tentative.https.sub.window.js.ini | 6------
Mtoolkit/components/antitracking/AntiTrackingUtils.cpp | 9+++++++++
2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/testing/web-platform/meta/storage-access-api/storage-access-headers.tentative.https.sub.window.js.ini b/testing/web-platform/meta/storage-access-api/storage-access-headers.tentative.https.sub.window.js.ini @@ -1,11 +1,5 @@ prefs: [dom.storage_access.headers.enabled:true] [storage-access-headers.tentative.https.sub.window.html] - [Activate-Storage-Access `load` header grants storage access to frame.] - expected: [PASS, FAIL] - - [Activate-Storage-Access `load` is honored for `active` cases.] - expected: [PASS, FAIL] - [Sec-Fetch-Storage-Access maintains value on same-origin redirect.] expected: FAIL diff --git a/toolkit/components/antitracking/AntiTrackingUtils.cpp b/toolkit/components/antitracking/AntiTrackingUtils.cpp @@ -699,7 +699,16 @@ nsresult AntiTrackingUtils::ActivateStoragePermissionStateInParent( 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. + nsILoadInfo::StoragePermissionState currentStorageAccess = + loadInfo->GetStoragePermission(); + MOZ_ASSERT(currentStorageAccess == nsILoadInfo::InactiveStoragePermission); +#endif + // Allow accessing unpartitioned cookies + MOZ_TRY(loadInfo->SetStoragePermission(nsILoadInfo::HasStoragePermission)); MOZ_TRY(wc->SetUsingStorageAccess(true)); return NS_OK;