Bug 1764696 - Replace dom.storage.next_gen with a new pref; r=dom-storage-reviewers,jstutte

Differential Revision: https://phabricator.services.mozilla.com/D143688
This commit is contained in:
Jan Varga 2022-05-04 04:35:14 +00:00
Родитель 561a4ac538
Коммит bc950d84d9
6 изменённых файлов: 50 добавлений и 6 удалений

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

@ -50,7 +50,10 @@ bool NextGenLocalStorageEnabled() {
// Ideally all this Mutex stuff would be replaced with just using
// an AtStartup StaticPref, but there are concerns about this causing
// deadlocks if this access needs to init the AtStartup cache.
bool enabled = StaticPrefs::dom_storage_next_gen_DoNotUseDirectly();
bool enabled =
!StaticPrefs::
dom_storage_enable_unsupported_legacy_implementation_DoNotUseDirectly();
gNextGenLocalStorageEnabled = enabled ? 1 : 0;
}

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

@ -0,0 +1,14 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* This test is mainly to verify that LSNG is not accidentally disabled which
* can lead to a data loss in a combination with disabled shadow writes.
*/
// eslint-disable-next-line no-unused-vars
async function testSteps() {
ok(Services.domStorageManager.nextGenLocalStorageEnabled, "LSNG enabled");
}

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

@ -0,0 +1,18 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* This test is mainly to verify that the old pref for switching LS
* implementations has no effect anymore.
*/
// eslint-disable-next-line no-unused-vars
async function testSteps() {
info("Setting pref");
Services.prefs.setBoolPref("dom.storage.next_gen", false);
ok(Services.domStorageManager.nextGenLocalStorageEnabled, "LSNG enabled");
}

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

@ -40,7 +40,9 @@ run-sequentially = this test depends on a file produced by test_databaseShadowin
[test_groupLimit.js]
[test_groupMismatch.js]
[test_largeItems.js]
[test_lsng_enabled.js]
[test_migration.js]
[test_old_lsng_pref.js]
[test_orderingAfterRemoveAdd.js]
[test_originInit.js]
[test_preloading.js]

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

@ -10,7 +10,10 @@ function* testSteps() {
info("Setting pref");
SpecialPowers.setBoolPref("dom.storage.next_gen", false);
SpecialPowers.setBoolPref(
"dom.storage.enable_unsupported_legacy_implementation",
true
);
// Profile 1
info("Clearing");

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

@ -3577,11 +3577,15 @@
value: 25 * 1024
mirror: always
# Whether or not LSNG (Next Generation Local Storage) is enabled.
# See bug 1599979 for enabling this unconditionally (second attempt).
- name: dom.storage.next_gen
# Whether or not the unsupported legacy implemenation should be enabled. Please
# don't advertise this pref as a way for disabling LSNG. This pref is intended
# for internal testing only and will be removed in near future. Accidental
# disabling of LSNG can lead to a data loss in a combination with disabled
# shadow writes. Disabling of shadow writes is the initial step towards
# removing legacy implementation and will be done soon.
- name: dom.storage.enable_unsupported_legacy_implementation
type: RelaxedAtomicBool
value: true
value: false
mirror: always
do_not_use_directly: true