commit 6a09a9ad8b53c6918ccb1c170a1e5976d7070fd2 parent a04b3e5e8d4042cf07390d7a160dc75258c45f6f Author: Tom Ritter <tom@mozilla.com> Date: Thu, 9 Oct 2025 12:53:07 +0000 Bug 1993304: Enable the newer, faster canvas randomization r=freddyb Differential Revision: https://phabricator.services.mozilla.com/D267998 Diffstat:
28 files changed, 189 insertions(+), 19 deletions(-)
diff --git a/browser/components/resistfingerprinting/test/browser/browser_canvas_iframes.js b/browser/components/resistfingerprinting/test/browser/browser_canvas_iframes.js @@ -69,6 +69,22 @@ let expectedResults = {}; var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { + registerCleanupFunction(async function () { + Services.prefs.clearUserPref( + "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" + ); + }); + + // Make sure Old Randomization is the only one on + await SpecialPowers.pushPrefEnv({ + set: [ + [ + "privacy.fingerprintingProtection.overrides", + "-EfficientCanvasRandomization,+CanvasRandomization", + ], + ], + }); + // Disable the fingerprinting randomization. await SpecialPowers.pushPrefEnv({ set: [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_canvas_popups.js b/browser/components/resistfingerprinting/test/browser/browser_canvas_popups.js @@ -66,6 +66,16 @@ let expectedResults = {}; var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { + // Make sure Old Randomization is the only one on + await SpecialPowers.pushPrefEnv({ + set: [ + [ + "privacy.fingerprintingProtection.overrides", + "-EfficientCanvasRandomization,+CanvasRandomization", + ], + ], + }); + // Disable the fingerprinting randomization. await SpecialPowers.pushPrefEnv({ set: [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_canvascompare_iframes.js b/browser/components/resistfingerprinting/test/browser/browser_canvascompare_iframes.js @@ -94,6 +94,16 @@ let expectedResults = {}; var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { + // Make sure Old Randomization is the only one on + await SpecialPowers.pushPrefEnv({ + set: [ + [ + "privacy.fingerprintingProtection.overrides", + "-EfficientCanvasRandomization,+CanvasRandomization", + ], + ], + }); + // Disable the fingerprinting randomization. await SpecialPowers.pushPrefEnv({ set: [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_canvascompare_iframes_aboutblank.js b/browser/components/resistfingerprinting/test/browser/browser_canvascompare_iframes_aboutblank.js @@ -97,6 +97,16 @@ let expectedResults = {}; var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { + // Make sure Old Randomization is the only one on + await SpecialPowers.pushPrefEnv({ + set: [ + [ + "privacy.fingerprintingProtection.overrides", + "-EfficientCanvasRandomization,+CanvasRandomization", + ], + ], + }); + // Disable the fingerprinting randomization. await SpecialPowers.pushPrefEnv({ set: [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_canvascompare_iframes_blob.js b/browser/components/resistfingerprinting/test/browser/browser_canvascompare_iframes_blob.js @@ -97,6 +97,16 @@ let expectedResults = {}; var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { + // Make sure Old Randomization is the only one on + await SpecialPowers.pushPrefEnv({ + set: [ + [ + "privacy.fingerprintingProtection.overrides", + "-EfficientCanvasRandomization,+CanvasRandomization", + ], + ], + }); + // Disable the fingerprinting randomization. await SpecialPowers.pushPrefEnv({ set: [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_canvascompare_iframes_data.js b/browser/components/resistfingerprinting/test/browser/browser_canvascompare_iframes_data.js @@ -97,6 +97,16 @@ let expectedResults = {}; var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { + // Make sure Old Randomization is the only one on + await SpecialPowers.pushPrefEnv({ + set: [ + [ + "privacy.fingerprintingProtection.overrides", + "-EfficientCanvasRandomization,+CanvasRandomization", + ], + ], + }); + // Disable the fingerprinting randomization. await SpecialPowers.pushPrefEnv({ set: [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_canvascompare_popups.js b/browser/components/resistfingerprinting/test/browser/browser_canvascompare_popups.js @@ -95,6 +95,16 @@ let expectedResults = {}; var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { + // Make sure Old Randomization is the only one on + await SpecialPowers.pushPrefEnv({ + set: [ + [ + "privacy.fingerprintingProtection.overrides", + "-EfficientCanvasRandomization,+CanvasRandomization", + ], + ], + }); + // Disable the fingerprinting randomization. await SpecialPowers.pushPrefEnv({ set: [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_canvascompare_popups_aboutblank.js b/browser/components/resistfingerprinting/test/browser/browser_canvascompare_popups_aboutblank.js @@ -96,6 +96,16 @@ let expectedResults = {}; var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { + // Make sure Old Randomization is the only one on + await SpecialPowers.pushPrefEnv({ + set: [ + [ + "privacy.fingerprintingProtection.overrides", + "-EfficientCanvasRandomization,+CanvasRandomization", + ], + ], + }); + // Disable the fingerprinting randomization. await SpecialPowers.pushPrefEnv({ set: [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_canvascompare_popups_blob.js b/browser/components/resistfingerprinting/test/browser/browser_canvascompare_popups_blob.js @@ -92,6 +92,16 @@ let expectedResults = {}; var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { + // Make sure Old Randomization is the only one on + await SpecialPowers.pushPrefEnv({ + set: [ + [ + "privacy.fingerprintingProtection.overrides", + "-EfficientCanvasRandomization,+CanvasRandomization", + ], + ], + }); + // Disable the fingerprinting randomization. await SpecialPowers.pushPrefEnv({ set: [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_canvascompare_popups_data.js b/browser/components/resistfingerprinting/test/browser/browser_canvascompare_popups_data.js @@ -92,6 +92,16 @@ let expectedResults = {}; var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { + // Make sure Old Randomization is the only one on + await SpecialPowers.pushPrefEnv({ + set: [ + [ + "privacy.fingerprintingProtection.overrides", + "-EfficientCanvasRandomization,+CanvasRandomization", + ], + ], + }); + // Disable the fingerprinting randomization. await SpecialPowers.pushPrefEnv({ set: [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_efficientcanvascompare_iframes.js b/browser/components/resistfingerprinting/test/browser/browser_efficientcanvascompare_iframes.js @@ -72,7 +72,7 @@ requestLongerTimeout(2); var UNMODIFIED_CANVAS_DATA = undefined; add_setup(async function () { - // Disable the fingerprinting randomization. + // Make sure Efficient Randomization is the only one on await SpecialPowers.pushPrefEnv({ set: [ [ diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_etp_iframes.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_etp_iframes.js @@ -29,6 +29,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes.js @@ -39,6 +39,12 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); + registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_aboutblank.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_aboutblank.js @@ -39,6 +39,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_aboutsrcdoc.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_aboutsrcdoc.js @@ -39,6 +39,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_blob.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_blob.js @@ -39,6 +39,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_blobcrossorigin.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_blobcrossorigin.js @@ -42,6 +42,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_data.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_data.js @@ -39,6 +39,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_sandboxediframe.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_sandboxediframe.js @@ -39,6 +39,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups.js @@ -35,6 +35,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_aboutblank.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_aboutblank.js @@ -34,6 +34,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_blob.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_blob.js @@ -34,6 +34,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_blob_noopener.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_blob_noopener.js @@ -34,6 +34,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_data.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_data.js @@ -34,6 +34,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_data_noopener.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_data_noopener.js @@ -34,6 +34,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_noopener.js b/browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_noopener.js @@ -34,6 +34,11 @@ async function testHWConcurrency(result, expectedResults, extraData) { } add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.fingerprintingProtection.overrides", "+NavigatorHWConcurrency"], + ], + }); registerCleanupFunction(async function () { Services.prefs.clearUserPref( "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" diff --git a/browser/components/resistfingerprinting/test/browser/head.js b/browser/components/resistfingerprinting/test/browser/head.js @@ -845,13 +845,7 @@ async function simpleFPPTest( extraData.testDesc = extraData.testDesc || "simple FPP enabled"; expectedResults.shouldRFPApply = false; await SpecialPowers.pushPrefEnv({ - set: [ - ["privacy.fingerprintingProtection", true], - [ - "privacy.fingerprintingProtection.overrides", - "+NavigatorHWConcurrency,+CanvasRandomization", - ], - ].concat(extraPrefs || []), + set: [["privacy.fingerprintingProtection", true]].concat(extraPrefs || []), }); await runActualTest(uri, testFunction, expectedResults, extraData); @@ -873,13 +867,9 @@ async function simplePBMFPPTest( extraData.testDesc = extraData.testDesc || "simple FPP in PBM enabled"; expectedResults.shouldRFPApply = false; await SpecialPowers.pushPrefEnv({ - set: [ - ["privacy.fingerprintingProtection.pbmode", true], - [ - "privacy.fingerprintingProtection.overrides", - "+NavigatorHWConcurrency,+CanvasRandomization", - ], - ].concat(extraPrefs || []), + set: [["privacy.fingerprintingProtection.pbmode", true]].concat( + extraPrefs || [] + ), }); await runActualTest(uri, testFunction, expectedResults, extraData); @@ -936,10 +926,6 @@ async function RFPPBMFPP_NormalMode_ProtectionsTest( ["privacy.resistFingerprinting", false], ["privacy.resistFingerprinting.pbmode", true], ["privacy.fingerprintingProtection", true], - [ - "privacy.fingerprintingProtection.overrides", - "+NavigatorHWConcurrency,+CanvasRandomization", - ], ].concat(extraPrefs || []), }); diff --git a/toolkit/components/resistfingerprinting/RFPTargetsDefault.inc b/toolkit/components/resistfingerprinting/RFPTargetsDefault.inc @@ -4,6 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ DESKTOP_DEFAULT(CanvasRandomization) +DESKTOP_DEFAULT(EfficientCanvasRandomization) DESKTOP_DEFAULT(FontVisibilityLangPack) DESKTOP_DEFAULT(JSMathFdlibm) DESKTOP_DEFAULT(ScreenAvailToResolution) @@ -11,6 +12,7 @@ DESKTOP_DEFAULT(NavigatorHWConcurrencyTiered) DESKTOP_DEFAULT(MaxTouchPointsCollapse) ANDROID_DEFAULT(CanvasRandomization) +ANDROID_DEFAULT(EfficientCanvasRandomization) ANDROID_DEFAULT(FontVisibilityLangPack) ANDROID_DEFAULT(JSMathFdlibm) ANDROID_DEFAULT(ScreenAvailToResolution)