tor-browser

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

commit a6e4f92f079e36ad86f84790e35e7d1d497c47bf
parent 5ee058cf7767b5e2ebae5558f99912d7d6d54596
Author: Jan Varga <Jan.Varga@gmail.com>
Date:   Wed, 12 Nov 2025 08:07:02 +0000

Bug 1988590 - QM: Add prefs to control clearing of non-persisted zero-usage origins; r=asuth,dom-storage-reviewers,jari

Introducing two new prefs:
- dom.quotaManager.temporaryStorage.clearNonPersistedZeroUsageOrigins controls
  whether non-persisted origins with zero quota-charged usage are cleared
  during the final steps of temporary storage initialization.
- dom.quotaManager.temporaryStorage.maxOriginsToClearDuringCleanup controls the
  maximum number of origins cleared in a single batch. Defaults to 50 on
  Android and 150 on other platforms. Currently this is only applied when
  clearing non-persisted zero-usage origins, but it is intended as a general
  batch limit for future clearing strategies as well.

Testing: The new prefs and related code is exercised in a new test
(test_temporaryStorageCleanup.js) added in a follow-up patch for this bug.

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

Diffstat:
Mmodules/libpref/init/StaticPrefList.yaml | 34++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+), 0 deletions(-)

diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml @@ -4072,6 +4072,40 @@ mirror: always do_not_use_directly: true +# Should we clear non-persisted origins with zero usage during final steps of +# temporary storage initialization? +# When enabled, the QuotaManager will automatically clear non-persisted +# origins that have zero quota-charged usage during final steps of temporary +# storage initialization. This removes directories and files belonging to +# origins that do not store any real data but still consume resources through +# bookkeeping structures on disk. The feature helps reduce storage bloat and +# improve initialization performance, especially on long-lived profiles with a +# large number of unused origins. +- name: dom.quotaManager.temporaryStorage.clearNonPersistedZeroUsageOrigins + type: RelaxedAtomicBool + value: false + mirror: always + +# Controls the maximum number of origins cleared in a single batch during +# final steps of temporary storage initialization. The value defaults to 50 on +# Android and 150 on other platforms. Smaller values can be useful for testing +# and experimentation to exercise multi-batch clearing behavior without +# requiring hundreds of origins. Larger values may reduce the number of +# batches but can increase I/O spikes. +# +# Currently this pref is only applied when clearing non-persisted zero-usage +# origins, but it is intended to serve as a general batch limit for other +# clearing strategies that may be introduced in the future (for example, to +# remove very old origins). +- name: dom.quotaManager.temporaryStorage.maxOriginsToClearDuringCleanup + type: RelaxedAtomicUint32 +#if defined(MOZ_WIDGET_ANDROID) + value: 50 +#else + value: 150 +#endif + mirror: always + # A pref that is used to slow down origin operations for testing purposes. - name: dom.quotaManager.originOperations.pauseOnIOThreadMs type: RelaxedAtomicUint32