tor-browser

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

commit 21fb33016fbfc2daa694ccc2beccb50058073213
parent 179a78623e2b991451b54bbd689074905215cb17
Author: Atila Butkovits <abutkovits@mozilla.com>
Date:   Thu,  6 Nov 2025 18:19:22 +0200

Revert "Bug 1998435 - Do not reset the default zoom when clearing the FFP state. r=manuel" for causing failures at browser_bug1975753_site_specific_zoom_level.js.

This reverts commit ebfba9ae402e48be88128ad9132d21129210113e.

Diffstat:
Mbrowser/components/resistfingerprinting/test/browser/browser_bug1975753_site_specific_zoom_level.js | 24++----------------------
Mtoolkit/components/cleardata/ClearDataService.sys.mjs | 66+++++++++++++++++++++++++++++++++++++++++++++---------------------
2 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/browser/components/resistfingerprinting/test/browser/browser_bug1975753_site_specific_zoom_level.js b/browser/components/resistfingerprinting/test/browser/browser_bug1975753_site_specific_zoom_level.js @@ -3,14 +3,10 @@ const PATH_NET = TEST_PATH + "file_dummy.html"; const PATH_ORG = PATH_NET.replace("example.net", "example.org"); -async function runTest(defaultZoom) { +add_task(async function () { let tab1, tab1Zoom; tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, PATH_NET); - - tab1Zoom = ZoomManager.getZoomForBrowser(tab1.linkedBrowser); - is(tab1Zoom, defaultZoom, "We are starting with the default zoom."); - await FullZoom.setZoom(1.25, tab1.linkedBrowser); tab1Zoom = ZoomManager.getZoomForBrowser(tab1.linkedBrowser); @@ -50,7 +46,7 @@ async function runTest(defaultZoom) { is( tab1Zoom, - defaultZoom, + 1.0, "privacy.resistFingerprinting is true, site-specific zoom should be reset when clearing FPP state for tab1" ); @@ -59,20 +55,4 @@ async function runTest(defaultZoom) { BrowserTestUtils.removeTab(tab1); await SpecialPowers.popPrefEnv(); -} - -add_task(async function () { - await runTest(1.0); - - let defaultZoom = 1.5; - let context = Cu.createLoadContext(); - let cps2 = Cc["@mozilla.org/content-pref/service;1"].getService( - Ci.nsIContentPrefService2 - ); - cps2.setGlobal(FullZoom.name, defaultZoom, context); - try { - await runTest(defaultZoom); - } finally { - cps2.removeGlobal(FullZoom.name, context); - } }); diff --git a/toolkit/components/cleardata/ClearDataService.sys.mjs b/toolkit/components/cleardata/ClearDataService.sys.mjs @@ -438,7 +438,11 @@ const CookieBannerExecutedRecordCleaner = { // A cleaner for cleaning fingerprinting protection states. const FingerprintingProtectionStateCleaner = { - async _maybeClearSiteSpecificZoom(aSchemelessSite, aOriginAttributes = {}) { + async _maybeClearSiteSpecificZoom( + deleteAll, + aSchemelessSite, + aOriginAttributes = {} + ) { if ( !ChromeUtils.shouldResistFingerprinting("SiteSpecificZoom", null, true) ) { @@ -451,24 +455,8 @@ const FingerprintingProtectionStateCleaner = { const ZOOM_PREF_NAME = "browser.content.full-zoom"; await new Promise((aResolve, aReject) => { - aOriginAttributes = - ChromeUtils.fillNonDefaultOriginAttributes(aOriginAttributes); - - let loadContext; - if ( - aOriginAttributes.privateBrowsingId == - Services.scriptSecurityManager.DEFAULT_PRIVATE_BROWSING_ID - ) { - loadContext = Cu.createLoadContext(); - } else { - loadContext = Cu.createPrivateLoadContext(); - } - - cps2.removeBySubdomainAndName( - aSchemelessSite, - ZOOM_PREF_NAME, - loadContext, - { + if (deleteAll) { + cps2.removeByName(ZOOM_PREF_NAME, null, { handleCompletion: aReason => { if (aReason === cps2.COMPLETE_ERROR) { aReject(); @@ -476,19 +464,50 @@ const FingerprintingProtectionStateCleaner = { aResolve(); } }, + }); + } else { + aOriginAttributes = + ChromeUtils.fillNonDefaultOriginAttributes(aOriginAttributes); + + let loadContext; + if ( + aOriginAttributes.privateBrowsingId == + Services.scriptSecurityManager.DEFAULT_PRIVATE_BROWSING_ID + ) { + loadContext = Cu.createLoadContext(); + } else { + loadContext = Cu.createPrivateLoadContext(); } - ); + + cps2.removeBySubdomainAndName( + aSchemelessSite, + ZOOM_PREF_NAME, + loadContext, + { + handleCompletion: aReason => { + if (aReason === cps2.COMPLETE_ERROR) { + aReject(); + } else { + aResolve(); + } + }, + } + ); + } }); }, async deleteAll() { Services.rfp.cleanAllRandomKeys(); + + await this._maybeClearSiteSpecificZoom(true); }, async deleteByPrincipal(aPrincipal) { Services.rfp.cleanRandomKeyByPrincipal(aPrincipal); await this._maybeClearSiteSpecificZoom( + false, aPrincipal.host, aPrincipal.originAttributes ); @@ -501,6 +520,7 @@ const FingerprintingProtectionStateCleaner = { ); await this._maybeClearSiteSpecificZoom( + false, aSchemelessSite, aOriginAttributesPattern ); @@ -512,7 +532,11 @@ const FingerprintingProtectionStateCleaner = { JSON.stringify(aOriginAttributesPattern) ); - await this._maybeClearSiteSpecificZoom(aHost, aOriginAttributesPattern); + await this._maybeClearSiteSpecificZoom( + false, + aHost, + aOriginAttributesPattern + ); }, async deleteByOriginAttributes(aOriginAttributesString) {