commit ba860649ac0fe6bafcaf41c9cc7959991679346e
parent 37f622b02d485c52faa15a1ad2a4293a0d9caf76
Author: Harsheet <hsohaney@mozilla.com>
Date: Thu, 9 Oct 2025 14:54:56 +0000
Bug 1991916 - Fix first load for backup header in about:preferences. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D266704
Diffstat:
3 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/browser/components/preferences/sync.inc.xhtml b/browser/components/preferences/sync.inc.xhtml
@@ -243,21 +243,24 @@
target="_blank"
data-l10n-id="sync-connect-another-device"/>
</vbox>
- </vbox>
+</vbox>
</deck>
<!-- Firefox Backup -->
-<hbox id="backupCategory"
+<vbox id="dataBackupSection" data-category="paneSync" data-hidden-from-search="true">
+ <hbox id="backupCategory"
class="subcategory"
hidden="true"
- data-category="paneSync">
- <html:h1 data-l10n-id="settings-data-backup-header"/>
-</hbox>
-<groupbox id="dataBackupGroup" data-category="paneSync"
- data-subcategory="backup" hidden="true"
- data-hidden-from-search="true">
- <label class="search-header" hidden="true"><html:h2 data-l10n-id="settings-data-backup-header"/></label>
- <hbox flex="1">
- <html:backup-settings />
- </hbox>
- </groupbox>
+ data-category="paneSync"
+ >
+ <html:h1 data-l10n-id="settings-data-backup-header"/>
+ </hbox>
+ <groupbox id="dataBackupGroup"
+ data-subcategory="backup"
+ hidden="true">
+ <label class="search-header" hidden="true"><html:h2 data-l10n-id="settings-data-backup-header"/></label>
+ <hbox flex="1">
+ <html:backup-settings />
+ </hbox>
+ </groupbox>
+</vbox>
</html:template>
diff --git a/browser/components/preferences/sync.js b/browser/components/preferences/sync.js
@@ -39,12 +39,6 @@ var gSyncPane = {
.getElementById("weavePrefsDeck")
.removeAttribute("data-hidden-from-search");
- if (Services.prefs.getBoolPref(BACKUP_UI_ENABLED_PREF, false)) {
- document
- .getElementById("dataBackupGroup")
- .removeAttribute("data-hidden-from-search");
- }
-
this.updateBackupUIVisibility();
// If the Service hasn't finished initializing, wait for it.
@@ -304,6 +298,13 @@ var gSyncPane = {
false
);
+ let dataBackupSectionEl = document.getElementById("dataBackupSection");
+
+ dataBackupSectionEl.toggleAttribute(
+ "data-hidden-from-search",
+ !isBackupUIEnabled
+ );
+
let dataBackupGroupEl = document.getElementById("dataBackupGroup");
let backupGroupHeaderEl = document.getElementById("backupCategory");
@@ -317,11 +318,14 @@ var gSyncPane = {
this.updateBackupUIVisibility
);
- window.addEventListener("unload", () =>
- Services.prefs.removeObserver(
- BACKUP_UI_ENABLED_PREF,
- this.updateBackupUIVisibility
- )
+ window.addEventListener(
+ "unload",
+ () =>
+ Services.prefs.removeObserver(
+ BACKUP_UI_ENABLED_PREF,
+ this.updateBackupUIVisibility
+ ),
+ { once: true }
);
},
diff --git a/browser/components/preferences/tests/browser_bug731866.js b/browser/components/preferences/tests/browser_bug731866.js
@@ -7,7 +7,7 @@ const browserContainersGroupDisabled = !SpecialPowers.getBoolPref(
const cookieBannerHandlingDisabled = !SpecialPowers.getBoolPref(
"cookiebanners.ui.desktop.enabled"
);
-const backupGroupDisabled = !SpecialPowers.getBoolPref(
+const backupSectionDisabled = !SpecialPowers.getBoolPref(
"browser.backup.preferences.ui.enabled"
);
const profilesGroupDisabled = !SelectableProfileService.isEnabled;
@@ -65,8 +65,8 @@ function checkElements(expectedPane) {
}
// Backup is currently disabled by default. (bug 1895791)
- if (element.id == "dataBackupGroup" && backupGroupDisabled) {
- is_element_hidden(element, "Disabled dataBackupGroup should be hidden");
+ if (element.id == "dataBackupSection" && backupSectionDisabled) {
+ is_element_hidden(element, "Disabled dataBackupSection should be hidden");
continue;
}