Loading browser/components/resistfingerprinting/test/browser/browser_bug1975753_site_specific_zoom_level.js +31 −2 Changes for browser/components/resistfingerprinting/test/browser/browser_bug1975753_site_specific_zoom_level.js: 31 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -3,10 +3,14 @@ const PATH_NET = TEST_PATH + "file_dummy.html"; const PATH_ORG = PATH_NET.replace("example.net", "example.org"); add_task(async function () { async function runTest(defaultZoom) { 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); Loading Loading @@ -46,7 +50,7 @@ add_task(async function () { is( tab1Zoom, 1.0, defaultZoom, "privacy.resistFingerprinting is true, site-specific zoom should be reset when clearing FPP state for tab1" ); Loading @@ -55,4 +59,29 @@ add_task(async function () { 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 ); let { promise, resolve, reject } = Promise.withResolvers(); cps2.setGlobal(FullZoom.name, defaultZoom, context, { handleError(error) { reject(error); }, handleCompletion() { resolve(); }, }); await promise; try { await runTest(defaultZoom); } finally { cps2.removeGlobal(FullZoom.name, context); } }); toolkit/components/cleardata/ClearDataService.sys.mjs +2 −26 Changes for toolkit/components/cleardata/ClearDataService.sys.mjs: 2 added lines, 26 removed lines. Original line number Diff line number Diff line Loading @@ -415,11 +415,7 @@ const CookieBannerExecutedRecordCleaner = { // A cleaner for cleaning fingerprinting protection states. const FingerprintingProtectionStateCleaner = { async _maybeClearSiteSpecificZoom( deleteAll, aSchemelessSite, aOriginAttributes = {} ) { async _maybeClearSiteSpecificZoom(aSchemelessSite, aOriginAttributes = {}) { if ( !ChromeUtils.shouldResistFingerprinting("SiteSpecificZoom", null, true) ) { Loading @@ -432,17 +428,6 @@ const FingerprintingProtectionStateCleaner = { const ZOOM_PREF_NAME = "browser.content.full-zoom"; await new Promise((aResolve, aReject) => { if (deleteAll) { cps2.removeByName(ZOOM_PREF_NAME, null, { handleCompletion: aReason => { if (aReason === cps2.COMPLETE_ERROR) { aReject(); } else { aResolve(); } }, }); } else { aOriginAttributes = ChromeUtils.fillNonDefaultOriginAttributes(aOriginAttributes); Loading Loading @@ -470,21 +455,17 @@ const FingerprintingProtectionStateCleaner = { }, } ); } }); }, async deleteAll() { Services.rfp.cleanAllRandomKeys(); await this._maybeClearSiteSpecificZoom(true); }, async deleteByPrincipal(aPrincipal) { Services.rfp.cleanRandomKeyByPrincipal(aPrincipal); await this._maybeClearSiteSpecificZoom( false, aPrincipal.host, aPrincipal.originAttributes ); Loading @@ -497,7 +478,6 @@ const FingerprintingProtectionStateCleaner = { ); await this._maybeClearSiteSpecificZoom( false, aSchemelessSite, aOriginAttributesPattern ); Loading @@ -509,11 +489,7 @@ const FingerprintingProtectionStateCleaner = { JSON.stringify(aOriginAttributesPattern) ); await this._maybeClearSiteSpecificZoom( false, aHost, aOriginAttributesPattern ); await this._maybeClearSiteSpecificZoom(aHost, aOriginAttributesPattern); }, async deleteByOriginAttributes(aOriginAttributesString) { Loading Loading
browser/components/resistfingerprinting/test/browser/browser_bug1975753_site_specific_zoom_level.js +31 −2 Changes for browser/components/resistfingerprinting/test/browser/browser_bug1975753_site_specific_zoom_level.js: 31 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -3,10 +3,14 @@ const PATH_NET = TEST_PATH + "file_dummy.html"; const PATH_ORG = PATH_NET.replace("example.net", "example.org"); add_task(async function () { async function runTest(defaultZoom) { 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); Loading Loading @@ -46,7 +50,7 @@ add_task(async function () { is( tab1Zoom, 1.0, defaultZoom, "privacy.resistFingerprinting is true, site-specific zoom should be reset when clearing FPP state for tab1" ); Loading @@ -55,4 +59,29 @@ add_task(async function () { 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 ); let { promise, resolve, reject } = Promise.withResolvers(); cps2.setGlobal(FullZoom.name, defaultZoom, context, { handleError(error) { reject(error); }, handleCompletion() { resolve(); }, }); await promise; try { await runTest(defaultZoom); } finally { cps2.removeGlobal(FullZoom.name, context); } });
toolkit/components/cleardata/ClearDataService.sys.mjs +2 −26 Changes for toolkit/components/cleardata/ClearDataService.sys.mjs: 2 added lines, 26 removed lines. Original line number Diff line number Diff line Loading @@ -415,11 +415,7 @@ const CookieBannerExecutedRecordCleaner = { // A cleaner for cleaning fingerprinting protection states. const FingerprintingProtectionStateCleaner = { async _maybeClearSiteSpecificZoom( deleteAll, aSchemelessSite, aOriginAttributes = {} ) { async _maybeClearSiteSpecificZoom(aSchemelessSite, aOriginAttributes = {}) { if ( !ChromeUtils.shouldResistFingerprinting("SiteSpecificZoom", null, true) ) { Loading @@ -432,17 +428,6 @@ const FingerprintingProtectionStateCleaner = { const ZOOM_PREF_NAME = "browser.content.full-zoom"; await new Promise((aResolve, aReject) => { if (deleteAll) { cps2.removeByName(ZOOM_PREF_NAME, null, { handleCompletion: aReason => { if (aReason === cps2.COMPLETE_ERROR) { aReject(); } else { aResolve(); } }, }); } else { aOriginAttributes = ChromeUtils.fillNonDefaultOriginAttributes(aOriginAttributes); Loading Loading @@ -470,21 +455,17 @@ const FingerprintingProtectionStateCleaner = { }, } ); } }); }, async deleteAll() { Services.rfp.cleanAllRandomKeys(); await this._maybeClearSiteSpecificZoom(true); }, async deleteByPrincipal(aPrincipal) { Services.rfp.cleanRandomKeyByPrincipal(aPrincipal); await this._maybeClearSiteSpecificZoom( false, aPrincipal.host, aPrincipal.originAttributes ); Loading @@ -497,7 +478,6 @@ const FingerprintingProtectionStateCleaner = { ); await this._maybeClearSiteSpecificZoom( false, aSchemelessSite, aOriginAttributesPattern ); Loading @@ -509,11 +489,7 @@ const FingerprintingProtectionStateCleaner = { JSON.stringify(aOriginAttributesPattern) ); await this._maybeClearSiteSpecificZoom( false, aHost, aOriginAttributesPattern ); await this._maybeClearSiteSpecificZoom(aHost, aOriginAttributesPattern); }, async deleteByOriginAttributes(aOriginAttributesString) { Loading