tor-browser

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

commit 5878b829e245ff7c58a8a035e61ee1828841d1e3
parent 81a7119f574ddb72a078967c1225ffc937ad0a0b
Author: Mark Striemer <mstriemer@mozilla.com>
Date:   Fri, 28 Nov 2025 22:55:47 +0000

Bug 1971844 - Convert Import browser data section to config-based card r=mconley,fluent-reviewers,bolsson

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

Diffstat:
Mbrowser/components/enterprisepolicies/tests/browser/browser_policy_disable_profile_import.js | 8++++++--
Mbrowser/components/preferences/main.inc.xhtml | 12+-----------
Mbrowser/components/preferences/main.js | 45++++++++++++++++++++++++---------------------
Mbrowser/locales/en-US/browser/preferences/preferences.ftl | 7++++---
Mbrowser/themes/shared/preferences/preferences.css | 6------
5 files changed, 35 insertions(+), 43 deletions(-)

diff --git a/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_profile_import.js b/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_profile_import.js @@ -88,8 +88,12 @@ add_task(async function test_prefs_entrypoint() { ); let doc = browser.contentDocument; ok( - !doc.getElementById("dataMigrationGroup"), - "Should remove import entrypoint in prefs if disabled via policy." + doc.getElementById("dataMigrationGroup"), + "Import entrypoint group should exist." + ); + ok( + BrowserTestUtils.isHidden(doc.getElementById("dataMigrationGroup")), + "Import entrypoint should be hidden in prefs if disabled via policy." ); ok( !doc.getElementById("migrationWizardDialog").open, diff --git a/browser/components/preferences/main.inc.xhtml b/browser/components/preferences/main.inc.xhtml @@ -33,17 +33,7 @@ </groupbox> <!-- Data migration --> -<groupbox id="dataMigrationGroup" data-category="paneGeneral" hidden="true"> - <label><html:h2 data-l10n-id="preferences-data-migration-header"/></label> - - <hbox id="dataMigration" flex="1"> - <description flex="1" control="data-migration" data-l10n-id="preferences-data-migration-description"/> - <button id="data-migration" - is="highlightable-button" - class="accessory-button" - data-l10n-id="preferences-data-migration-button"/> - </hbox> -</groupbox> +<html:setting-group groupid="importBrowserData" id="dataMigrationGroup" data-category="paneGeneral" hidden="true" /> <!-- Profiles --> <groupbox id="profilesGroup" data-category="paneGeneral" hidden="true"> diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js @@ -630,6 +630,18 @@ Preferences.addSetting({ Preferences.addSetting({ id: "containersPlaceholder" }); Preferences.addSetting({ + id: "data-migration", + visible: () => + !Services.policies || Services.policies.isAllowed("profileImport"), + onUserClick() { + const browserWindow = window.browsingContext.topChromeWindow; + MigrationUtils.showMigrationWizard(browserWindow, { + entrypoint: MigrationUtils.MIGRATION_ENTRYPOINTS.PREFERENCES, + }); + }, +}); + +Preferences.addSetting({ id: "connectionSettings", onUserClick: () => gMainPane.showConnections(), }); @@ -1749,6 +1761,17 @@ SettingGroupManager.registerGroups({ }, ], }, + importBrowserData: { + l10nId: "preferences-data-migration-group", + headingLevel: 2, + items: [ + { + id: "data-migration", + l10nId: "preferences-data-migration-button", + control: "moz-box-button", + }, + ], + }, home: { inProgress: true, headingLevel: 2, @@ -3019,6 +3042,7 @@ var gMainPane = { initSettingGroup("zoom"); initSettingGroup("performance"); initSettingGroup("startup"); + initSettingGroup("importBrowserData"); initSettingGroup("networkProxy"); initSettingGroup("tabs"); initSettingGroup("profiles"); @@ -3067,11 +3091,6 @@ var gMainPane = { gMainPane.updateColorsButton.bind(gMainPane) ); gMainPane.updateColorsButton(); - setEventListener( - "data-migration", - "command", - gMainPane.onMigrationButtonCommand - ); document .getElementById("browserLayoutShowSidebar") @@ -3087,10 +3106,6 @@ var gMainPane = { e.currentTarget.close(); }); - if (Services.policies && !Services.policies.isAllowed("profileImport")) { - document.getElementById("dataMigrationGroup").remove(); - } - // Initializes the fonts dropdowns displayed in this pane. this._rebuildFonts(); @@ -4418,18 +4433,6 @@ var gMainPane = { })().catch(console.error); }, - onMigrationButtonCommand() { - // Even though we're going to be showing the migration wizard here in - // about:preferences, we'll delegate the call to - // `MigrationUtils.showMigrationWizard`, as this will allow us to - // properly measure entering the dialog from the PREFERENCES entrypoint. - const browserWindow = window.browsingContext.topChromeWindow; - - MigrationUtils.showMigrationWizard(browserWindow, { - entrypoint: MigrationUtils.MIGRATION_ENTRYPOINTS.PREFERENCES, - }); - }, - /** * Displays the migration wizard dialog in an HTML dialog. */ diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl @@ -171,10 +171,11 @@ windows-launch-on-login-disabled = This preference has been disabled in Windows. disable-extension = .label = Disable Extension -preferences-data-migration-header = Import Browser Data -preferences-data-migration-description = Import bookmarks, passwords, history, and autofill data into { -brand-short-name }. +preferences-data-migration-group = + .label = Import browser data + .description = Bring your bookmarks, passwords, history, extensions, and autofill data from another browser. preferences-data-migration-button = - .label = Import Data + .label = Import data .accesskey = m preferences-profiles-group-header = diff --git a/browser/themes/shared/preferences/preferences.css b/browser/themes/shared/preferences/preferences.css @@ -259,12 +259,6 @@ radio { } } -#dataMigration { - /* This should really be using baseline, but that doesn't work properly with - * the <description> and XUL <button> markup. */ - align-items: center; -} - .extension-controlled { margin-block: 18px; }