Bug 1706219 - Handle gSavedSate without placements in proton toolbar migration r=Gijs
Depends on D113423 Differential Revision: https://phabricator.services.mozilla.com/D113432
This commit is contained in:
@@ -641,7 +641,7 @@ var CustomizableUIInternal = {
|
||||
return;
|
||||
}
|
||||
|
||||
let placements = gSavedState?.placements[CustomizableUI.AREA_NAVBAR];
|
||||
let placements = gSavedState?.placements?.[CustomizableUI.AREA_NAVBAR];
|
||||
|
||||
if (!placements) {
|
||||
// The profile was created with this version, so no need to migrate.
|
||||
|
||||
@@ -246,9 +246,9 @@ add_task(async function testNullSavedState() {
|
||||
});
|
||||
|
||||
/**
|
||||
* Checks that a saved state that is missing the placements value does not prevent migration.
|
||||
* Checks that a saved state that is missing nav-bar placements does not prevent migration.
|
||||
*/
|
||||
add_task(async function testNullPlacements() {
|
||||
add_task(async function testNoNavbarPlacements() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[kPrefProtonToolbarVersion, 0],
|
||||
@@ -278,3 +278,35 @@ add_task(async function testNullPlacements() {
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
/**
|
||||
* Checks that a saved state that is missing the placements value does not prevent migration.
|
||||
*/
|
||||
add_task(async function testNullPlacements() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[kPrefProtonToolbarVersion, 0],
|
||||
[kPrefProtonToolbarEnabled, true],
|
||||
],
|
||||
});
|
||||
|
||||
let oldState = CustomizableUIBSPass.gSavedState;
|
||||
|
||||
Assert.equal(
|
||||
Services.prefs.getIntPref(kPrefProtonToolbarVersion),
|
||||
0,
|
||||
"Toolbar proton version is 0"
|
||||
);
|
||||
|
||||
let { CustomizableUIInternal } = CustomizableUIBSPass;
|
||||
|
||||
CustomizableUIBSPass.gSavedState = {};
|
||||
CustomizableUIInternal._updateForNewProtonVersion();
|
||||
|
||||
Assert.ok(true, "_updateForNewProtonVersion didn't throw");
|
||||
|
||||
// Cleanup
|
||||
CustomizableUIBSPass.gSavedState = oldState;
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user