Bug 1895978 - Add the new clear on shutdown cache pref to the cache purging task code. r=pbz,necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D210681
This commit is contained in:
Harshit Sohaney 2024-05-25 15:19:14 +00:00
Родитель 17372d5f6f
Коммит ffbc69a780
2 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -14217,6 +14217,11 @@
value: 1000 value: 1000
mirror: always mirror: always
- name: privacy.sanitize.useOldClearHistoryDialog
type: RelaxedAtomicBool
value: true
mirror: always
- name: privacy.sanitize.sanitizeOnShutdown - name: privacy.sanitize.sanitizeOnShutdown
type: RelaxedAtomicBool type: RelaxedAtomicBool
value: false value: false
@ -14227,6 +14232,11 @@
value: false value: false
mirror: always mirror: always
- name: privacy.clearOnShutdown_v2.cache
type: RelaxedAtomicBool
value: false
mirror: always
- name: privacy.dynamic_firstparty.limitForeign - name: privacy.dynamic_firstparty.limitForeign
type: RelaxedAtomicBool type: RelaxedAtomicBool
value: false value: false

Просмотреть файл

@ -73,8 +73,14 @@ class CacheObserver : public nsIObserver, public nsSupportsWeakReference {
} }
static uint32_t HalfLifeSeconds() { return sHalfLifeHours * 60.0F * 60.0F; } static uint32_t HalfLifeSeconds() { return sHalfLifeHours * 60.0F * 60.0F; }
static bool ClearCacheOnShutdown() { static bool ClearCacheOnShutdown() {
return StaticPrefs::privacy_sanitize_sanitizeOnShutdown() && if (!StaticPrefs::privacy_sanitize_sanitizeOnShutdown()) {
StaticPrefs::privacy_clearOnShutdown_cache(); return false;
}
if (StaticPrefs::privacy_sanitize_useOldClearHistoryDialog()) {
return StaticPrefs::privacy_clearOnShutdown_cache();
}
// use the new cache clearing pref for the new clear history dialog
return StaticPrefs::privacy_clearOnShutdown_v2_cache();
} }
static void ParentDirOverride(nsIFile** aDir); static void ParentDirOverride(nsIFile** aDir);