tor-browser

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

commit 969dea41d211479acd825a9bab1b8d456a7b0731
parent 4af16768a4e9203739691a9b1768247dabb5e5f5
Author: Emma Zuehlcke <emz@mozilla.com>
Date:   Tue, 28 Oct 2025 16:13:28 +0000

Bug 1991526 - Update xpcshell tests which have a BTP dependency to emit profile-after-change. r=search-reviewers,manuel,scunnane

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

Diffstat:
Mdom/push/test/xpcshell/test_clear_forgetAboutSite.js | 2+-
Msecurity/manager/ssl/tests/unit/test_forget_about_site_security_headers.js | 2+-
Atoolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/head.js | 7+++++++
Mtoolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_clearExpiredUserActivation.js | 3---
Mtoolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_importUserActivationPermissions.js | 3---
Mtoolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_purge.js | 3---
Mtoolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_purge_telemetry.js | 3---
Mtoolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_storage_batch_write.js | 4----
Mtoolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_telemetry_purge_num_hosts.js | 3---
Mtoolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/xpcshell.toml | 1+
Mtoolkit/components/antitracking/test/xpcshell/test_purge_trackers.js | 3+++
Mtoolkit/components/antitracking/test/xpcshell/test_purge_trackers_telemetry.js | 3+++
Mtoolkit/components/antitracking/test/xpcshell/test_staticPartition_authhttp.js | 2+-
Mtoolkit/components/cleardata/tests/unit/head.js | 2+-
Mtoolkit/components/cleardata/tests/unit/test_bounce_tracking_protection.js | 2--
Mtoolkit/components/cleardata/tests/unit/test_cookie_banner_handling.js | 2--
Mtoolkit/components/cleardata/tests/unit/test_fingerprinting_protection_state.js | 2--
Mtoolkit/components/cleardata/tests/unit/test_identity_credential_storage.js | 2--
Mtoolkit/components/forgetaboutsite/test/unit/head_forgetaboutsite.js | 2+-
Mtoolkit/components/search/tests/xpcshell/head_search.js | 2+-
20 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/dom/push/test/xpcshell/test_clear_forgetAboutSite.js b/dom/push/test/xpcshell/test_clear_forgetAboutSite.js @@ -13,7 +13,7 @@ function promiseUnregister(keyID) { } function run_test() { - do_get_profile(); + do_get_profile(true); setPrefs({ userAgentID, }); diff --git a/security/manager/ssl/tests/unit/test_forget_about_site_security_headers.js b/security/manager/ssl/tests/unit/test_forget_about_site_security_headers.js @@ -13,7 +13,7 @@ const { ForgetAboutSite } = ChromeUtils.importESModule( "resource://gre/modules/ForgetAboutSite.sys.mjs" ); -do_get_profile(); // must be done before instantiating nsIX509CertDB +do_get_profile(true); // must be done before instantiating nsIX509CertDB and calling ForgetAboutSite. registerCleanupFunction(() => { Services.prefs.clearUserPref("security.cert_pinning.enforcement_level"); diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/head.js b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/head.js @@ -0,0 +1,7 @@ +/* Any copyright is dedicated to the Public Domain. +http://creativecommons.org/publicdomain/zero/1.0/ */ + +add_setup(function () { + // BTP needs a temporary profile for storage. + do_get_profile(true); +}); diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_clearExpiredUserActivation.js b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_clearExpiredUserActivation.js @@ -4,9 +4,6 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; add_setup(function () { - // BTP needs a profile for storage. - do_get_profile(); - Services.prefs.setIntPref( "privacy.bounceTrackingProtection.mode", Ci.nsIBounceTrackingProtection.MODE_ENABLED diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_importUserActivationPermissions.js b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_importUserActivationPermissions.js @@ -39,9 +39,6 @@ function cleanup() { } add_setup(function () { - // Need a profile to data clearing calls. - do_get_profile(); - Services.prefs.setIntPref( "privacy.bounceTrackingProtection.mode", Ci.nsIBounceTrackingProtection.MODE_ENABLED diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_purge.js b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_purge.js @@ -67,9 +67,6 @@ function assertEmpty() { } add_setup(function () { - // Need a profile to data clearing calls. - do_get_profile(); - Services.prefs.setIntPref( "privacy.bounceTrackingProtection.mode", Ci.nsIBounceTrackingProtection.MODE_ENABLED diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_purge_telemetry.js b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_purge_telemetry.js @@ -32,9 +32,6 @@ function waitForPurgeTelemetry(siteHosts) { } add_setup(async function () { - // Need a profile to data clearing calls. - do_get_profile(); - Services.prefs.setIntPref( "privacy.bounceTrackingProtection.mode", Ci.nsIBounceTrackingProtection.MODE_ENABLED diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_storage_batch_write.js b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_storage_batch_write.js @@ -65,10 +65,6 @@ async function waitForDBSkipFlush() { } add_setup(async function () { - // BTP storage needs a profile directory to work. That's where the sqlite - // database file is stored. - do_get_profile(); - // Get the sqlite database file path. let profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile); let dbFile = profileDir.clone(); diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_telemetry_purge_num_hosts.js b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_telemetry_purge_num_hosts.js @@ -6,9 +6,6 @@ let btp; add_setup(function () { - // Need a profile to data clearing calls. - do_get_profile(); - Services.prefs.setIntPref( "privacy.bounceTrackingProtection.mode", Ci.nsIBounceTrackingProtection.MODE_ENABLED diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/xpcshell.toml b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/xpcshell.toml @@ -1,4 +1,5 @@ [DEFAULT] +head = "head.js" prefs = [ "privacy.bounceTrackingProtection.mode=1", "privacy.bounceTrackingProtection.enableTestMode=true", diff --git a/toolkit/components/antitracking/test/xpcshell/test_purge_trackers.js b/toolkit/components/antitracking/test/xpcshell/test_purge_trackers.js @@ -43,6 +43,9 @@ async function setupTest(aCookieBehavior) { // Enables us to test localStorage in xpcshell. Services.prefs.setBoolPref("dom.storage.client_validation", false); + + // Needed for BounceTrackingProtection. + do_get_profile(true); } /** diff --git a/toolkit/components/antitracking/test/xpcshell/test_purge_trackers_telemetry.js b/toolkit/components/antitracking/test/xpcshell/test_purge_trackers_telemetry.js @@ -41,6 +41,9 @@ add_task(async function setup() { // Enables us to test localStorage in xpcshell. Services.prefs.setBoolPref("dom.storage.client_validation", false); + + // Needed for BounceTrackingProtection. + do_get_profile(true); }); /** diff --git a/toolkit/components/antitracking/test/xpcshell/test_staticPartition_authhttp.js b/toolkit/components/antitracking/test/xpcshell/test_staticPartition_authhttp.js @@ -54,7 +54,7 @@ let observer = channel => { Services.obs.addObserver(observer, "http-on-modify-request"); add_task(async () => { - do_get_profile(); + do_get_profile(true); Services.prefs.setBoolPref("network.predictor.enabled", false); Services.prefs.setBoolPref("network.predictor.enable-prefetch", false); diff --git a/toolkit/components/cleardata/tests/unit/head.js b/toolkit/components/cleardata/tests/unit/head.js @@ -8,7 +8,7 @@ const { PermissionTestUtils } = ChromeUtils.importESModule( ); function run_test() { - do_get_profile(); + do_get_profile(true); run_next_test(); } diff --git a/toolkit/components/cleardata/tests/unit/test_bounce_tracking_protection.js b/toolkit/components/cleardata/tests/unit/test_bounce_tracking_protection.js @@ -119,8 +119,6 @@ function addTestData() { ); } -do_get_profile(); - add_task(async function test_deleteAll() { addTestData(); diff --git a/toolkit/components/cleardata/tests/unit/test_cookie_banner_handling.js b/toolkit/components/cleardata/tests/unit/test_cookie_banner_handling.js @@ -3,8 +3,6 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; -do_get_profile(); - add_setup(_ => { // Init cookieBannerService and pretend we opened a profile. let cbs = Cc["@mozilla.org/cookie-banner-service;1"].getService( diff --git a/toolkit/components/cleardata/tests/unit/test_fingerprinting_protection_state.js b/toolkit/components/cleardata/tests/unit/test_fingerprinting_protection_state.js @@ -3,8 +3,6 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; -do_get_profile(); - add_task(async function test_clear_fingerprinting_protection_state() { info("Enabling fingerprinting randomization"); Services.prefs.setBoolPref("privacy.resistFingerprinting", true); diff --git a/toolkit/components/cleardata/tests/unit/test_identity_credential_storage.js b/toolkit/components/cleardata/tests/unit/test_identity_credential_storage.js @@ -14,8 +14,6 @@ XPCOMUtils.defineLazyServiceGetter( Ci.nsIIdentityCredentialStorageService ); -do_get_profile(); - add_task(async function test_deleteByRange() { Services.prefs.setBoolPref( "dom.security.credentialmanagement.identity.enabled", diff --git a/toolkit/components/forgetaboutsite/test/unit/head_forgetaboutsite.js b/toolkit/components/forgetaboutsite/test/unit/head_forgetaboutsite.js @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -var profileDir = do_get_profile(); +var profileDir = do_get_profile(true); /** * Removes any files that could make our tests fail. diff --git a/toolkit/components/search/tests/xpcshell/head_search.js b/toolkit/components/search/tests/xpcshell/head_search.js @@ -38,7 +38,7 @@ const RemoteSettingsUtils = Utils; updateAppInfo({ name: "XPCShell", version: "48", platformVersion: "48" }); // We generally also need a profile set-up, for saving search settings etc. -do_get_profile(); +do_get_profile(true); SearchTestUtils.init(this);