Bug 1820655 - Add a new section to about:preferences to launch the migration wizard. r=jhirsch,fluent-reviewers,flod DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D172324
This commit is contained in:
Mike Conley
2023-03-15 00:35:16 +00:00
parent 96854f5647
commit 5c075e9201
7 changed files with 166 additions and 57 deletions

View File

@@ -949,6 +949,9 @@ class MigrationUtils {
/** Migration is being started from the Bookmarks Toolbar */ /** Migration is being started from the Bookmarks Toolbar */
BOOKMARKS_TOOLBAR: 8, BOOKMARKS_TOOLBAR: 8,
/** Migration is being started from about:preferences */
PREFERENCES: 9,
}); });
/** /**

View File

@@ -56,6 +56,19 @@
</groupbox> </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" align="start" 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>
<!-- Tab preferences --> <!-- Tab preferences -->
<groupbox data-category="paneGeneral" <groupbox data-category="paneGeneral"
hidden="true"> hidden="true">

View File

@@ -10,6 +10,7 @@
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
BackgroundUpdate: "resource://gre/modules/BackgroundUpdate.sys.mjs", BackgroundUpdate: "resource://gre/modules/BackgroundUpdate.sys.mjs",
MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs",
}); });
// Constants & Enumeration Values // Constants & Enumeration Values
@@ -472,6 +473,11 @@ var gMainPane = {
"command", "command",
gMainPane.showContainerSettings gMainPane.showContainerSettings
); );
setEventListener(
"data-migration",
"command",
gMainPane.onMigrationButtonCommand
);
// For media control toggle button, we support it on Windows 8.1+ (NT6.3), // For media control toggle button, we support it on Windows 8.1+ (NT6.3),
// MacOs 10.4+ (darwin8.0, but we already don't support that) and // MacOs 10.4+ (darwin8.0, but we already don't support that) and
@@ -1713,6 +1719,26 @@ var gMainPane = {
})().catch(console.error); })().catch(console.error);
}, },
onMigrationButtonCommand(command) {
// When browser.migrate.content-modal.enabled is enabled by default,
// the event handler can just call showMigrationWizardDialog directly,
// but for now, we delegate to MigrationUtils to open the native modal
// in case that's the dialog we're still using.
//
// Enabling the pref by default will be part of bug 1822156.
const browser = window.docShell.chromeEventHandler;
const browserWindow = browser.ownerGlobal;
// showMigrationWizard blocks on some platforms. We'll dispatch the request
// to open to a runnable on the main thread so that we don't have to block
// this function call.
Services.tm.dispatchToMainThread(() => {
MigrationUtils.showMigrationWizard(browserWindow, {
entrypoint: MigrationUtils.MIGRATION_ENTRYPOINTS.PREFERENCES,
});
});
},
/** /**
* Displays the migration wizard dialog in an HTML dialog. * Displays the migration wizard dialog in an HTML dialog.
*/ */

View File

@@ -10,45 +10,15 @@ support-files =
addons/set_homepage.xpi addons/set_homepage.xpi
addons/set_newtab.xpi addons/set_newtab.xpi
[browser_application_xml_handle_internally.js]
[browser_applications_selection.js]
[browser_advanced_update.js] [browser_advanced_update.js]
skip-if = !updater skip-if = !updater
[browser_application_xml_handle_internally.js]
[browser_applications_selection.js]
[browser_basic_rebuild_fonts_test.js] [browser_basic_rebuild_fonts_test.js]
[browser_bug410900.js] [browser_browser_languages_subdialog.js]
[browser_bug731866.js]
[browser_bug1579418.js]
[browser_etp_exceptions_dialog.js]
[browser_experimental_features.js]
[browser_experimental_features_filter.js]
[browser_experimental_features_hidden_when_not_public.js]
skip-if = skip-if =
os == "mac" && debug # Bug 1723854 tsan
os == "linux" && os_version == "18.04" && debug # Bug 1723854 (!debug && os == 'win') # Bug 1518370
[browser_experimental_features_resetall.js]
[browser_filetype_dialog.js]
[browser_ignore_invalid_capability.js]
[browser_moreFromMozilla.js]
[browser_moreFromMozilla_locales.js]
[browser_pdf_disabled.js]
[browser_search_no_results_change_category.js]
[browser_search_searchTerms.js]
[browser_search_within_preferences_1.js]
skip-if = (os == 'win' && processor == "aarch64") # Bug 1536560
[browser_search_within_preferences_2.js]
[browser_search_within_preferences_command.js]
[browser_search_subdialog_tooltip_saved_addresses.js]
[browser_search_subdialogs_within_preferences_1.js]
skip-if = tsan # Bug 1678829
[browser_search_subdialogs_within_preferences_2.js]
[browser_search_subdialogs_within_preferences_3.js]
[browser_search_subdialogs_within_preferences_4.js]
[browser_search_subdialogs_within_preferences_5.js]
[browser_search_subdialogs_within_preferences_6.js]
[browser_search_subdialogs_within_preferences_7.js]
[browser_search_subdialogs_within_preferences_8.js]
[browser_search_subdialogs_within_preferences_site_data.js]
[browser_bug795764_cachedisabled.js]
[browser_bug1018066_resetScrollPosition.js] [browser_bug1018066_resetScrollPosition.js]
[browser_bug1020245_openPreferences_to_paneContent.js] [browser_bug1020245_openPreferences_to_paneContent.js]
[browser_bug1184989_prevent_scrolling_when_preferences_flipped.js] [browser_bug1184989_prevent_scrolling_when_preferences_flipped.js]
@@ -57,59 +27,83 @@ skip-if = os == "mac" # 1664576
support-files = support-files =
browser_bug1184989_prevent_scrolling_when_preferences_flipped.xhtml browser_bug1184989_prevent_scrolling_when_preferences_flipped.xhtml
[browser_bug1547020_lockedDownloadDir.js] [browser_bug1547020_lockedDownloadDir.js]
[browser_cookie_exceptions_addRemove.js] [browser_bug1579418.js]
[browser_bug410900.js]
[browser_bug731866.js]
[browser_bug795764_cachedisabled.js]
[browser_cert_export.js] [browser_cert_export.js]
[browser_engines.js]
[browser_change_app_handler.js] [browser_change_app_handler.js]
skip-if = os != "win" # Windows-specific handler application selection dialog skip-if = os != "win" # Windows-specific handler application selection dialog
[browser_checkspelling.js] [browser_checkspelling.js]
[browser_connection.js] [browser_connection.js]
[browser_connection_bug388287.js]
[browser_connection_bug1445991.js] [browser_connection_bug1445991.js]
[browser_connection_bug1505330.js] [browser_connection_bug1505330.js]
skip-if = (verify && debug && (os == 'linux' || os == 'mac')) skip-if = (verify && debug && (os == 'linux' || os == 'mac'))
[browser_connection_bug388287.js]
[browser_connection_dnsoverhttps.js] [browser_connection_dnsoverhttps.js]
[browser_contentblocking_categories.js] [browser_containers_name_input.js]
[browser_contentblocking.js] [browser_contentblocking.js]
skip-if = socketprocess_networking skip-if = socketprocess_networking
[browser_contentblocking_categories.js]
[browser_contentblocking_standard_tcp_section.js] [browser_contentblocking_standard_tcp_section.js]
[browser_cookie_exceptions_addRemove.js]
[browser_cookies_exceptions.js] [browser_cookies_exceptions.js]
[browser_defaultbrowser_alwayscheck.js] [browser_defaultbrowser_alwayscheck.js]
[browser_engines.js]
[browser_etp_exceptions_dialog.js]
[browser_experimental_features.js]
[browser_experimental_features_filter.js]
[browser_experimental_features_hidden_when_not_public.js]
skip-if =
os == "mac" && debug # Bug 1723854
os == "linux" && os_version == "18.04" && debug # Bug 1723854
[browser_experimental_features_resetall.js]
[browser_extension_controlled.js]
skip-if =
tsan
ccov && (os == 'linux' || os == 'win') # Linux: bug 1613530, Windows: bug 1437051
[browser_filetype_dialog.js]
[browser_fluent.js]
[browser_homepage_default.js]
[browser_homepages_filter_aboutpreferences.js] [browser_homepages_filter_aboutpreferences.js]
[browser_homepages_use_bookmark.js] [browser_homepages_use_bookmark.js]
[browser_homepage_default.js] [browser_hometab_restore_defaults.js]
https_first_disabled = true
[browser_https_only_exceptions.js] [browser_https_only_exceptions.js]
[browser_https_only_section.js] [browser_https_only_section.js]
[browser_extension_controlled.js] [browser_ignore_invalid_capability.js]
skip-if = tsan || ccov && (os == 'linux' || os == 'win') # Linux: bug 1613530, Windows: bug 1437051
[browser_languages_subdialog.js] [browser_languages_subdialog.js]
[browser_browser_languages_subdialog.js]
skip-if = tsan || (!debug && os == 'win') # Bug 1518370
[browser_layersacceleration.js] [browser_layersacceleration.js]
[browser_localSearchShortcuts.js] [browser_localSearchShortcuts.js]
[browser_primaryPassword.js] [browser_moreFromMozilla.js]
[browser_moreFromMozilla_locales.js]
[browser_newtab_menu.js] [browser_newtab_menu.js]
[browser_notifications_do_not_disturb.js] [browser_notifications_do_not_disturb.js]
[browser_open_download_preferences.js] [browser_open_download_preferences.js]
support-files = empty_pdf_file.pdf support-files = empty_pdf_file.pdf
[browser_open_migration_wizard.js]
[browser_password_management.js] [browser_password_management.js]
[browser_pdf_disabled.js]
[browser_performance.js] [browser_performance.js]
[browser_performance_content_process_limit.js] [browser_performance_content_process_limit.js]
[browser_performance_e10srollout.js] [browser_performance_e10srollout.js]
[browser_performance_non_e10s.js] [browser_performance_non_e10s.js]
skip-if = true skip-if = true
[browser_permissions_checkPermissionsWereAdded.js] [browser_permissions_checkPermissionsWereAdded.js]
[browser_permissions_dialog.js]
[browser_permissions_dialog_default_perm.js]
[browser_permissions_urlFieldHidden.js] [browser_permissions_urlFieldHidden.js]
[browser_proxy_backup.js] [browser_primaryPassword.js]
[browser_privacypane_2.js]
[browser_privacypane_3.js]
[browser_privacy_cookieBannerHandling.js] [browser_privacy_cookieBannerHandling.js]
[browser_privacy_firefoxSuggest.js] [browser_privacy_firefoxSuggest.js]
[browser_privacy_passwordGenerationAndAutofill.js] [browser_privacy_passwordGenerationAndAutofill.js]
[browser_privacy_relayIntegration.js]
[browser_privacy_quickactions.js] [browser_privacy_quickactions.js]
[browser_privacy_relayIntegration.js]
[browser_privacy_segmentation_pref.js] [browser_privacy_segmentation_pref.js]
[browser_privacy_syncDataClearing.js] [browser_privacy_syncDataClearing.js]
[browser_privacypane_2.js]
[browser_privacypane_3.js]
[browser_proxy_backup.js]
[browser_sanitizeOnShutdown_prefLocked.js] [browser_sanitizeOnShutdown_prefLocked.js]
[browser_searchChangedEngine.js] [browser_searchChangedEngine.js]
[browser_searchDefaultEngine.js] [browser_searchDefaultEngine.js]
@@ -122,15 +116,30 @@ support-files =
support-files = support-files =
!/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js !/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
[browser_searchShowSuggestionsFirst.js] [browser_searchShowSuggestionsFirst.js]
[browser_search_no_results_change_category.js]
[browser_search_searchTerms.js]
[browser_search_subdialog_tooltip_saved_addresses.js]
[browser_search_subdialogs_within_preferences_1.js]
skip-if = tsan # Bug 1678829
[browser_search_subdialogs_within_preferences_2.js]
[browser_search_subdialogs_within_preferences_3.js]
[browser_search_subdialogs_within_preferences_4.js]
[browser_search_subdialogs_within_preferences_5.js]
[browser_search_subdialogs_within_preferences_6.js]
[browser_search_subdialogs_within_preferences_7.js]
[browser_search_subdialogs_within_preferences_8.js]
[browser_search_subdialogs_within_preferences_site_data.js]
[browser_search_within_preferences_1.js]
skip-if = (os == 'win' && processor == "aarch64") # Bug 1536560
[browser_search_within_preferences_2.js]
[browser_search_within_preferences_command.js]
[browser_searchsuggestions.js] [browser_searchsuggestions.js]
[browser_security-1.js] [browser_security-1.js]
[browser_security-2.js] [browser_security-2.js]
[browser_security-3.js] [browser_security-3.js]
[browser_spotlight.js]
[browser_site_login_exceptions.js] [browser_site_login_exceptions.js]
[browser_site_login_exceptions_policy.js] [browser_site_login_exceptions_policy.js]
[browser_permissions_dialog.js] [browser_spotlight.js]
[browser_permissions_dialog_default_perm.js]
[browser_statePartitioning_PBM_strings.js] [browser_statePartitioning_PBM_strings.js]
[browser_statePartitioning_strings.js] [browser_statePartitioning_strings.js]
[browser_subdialogs.js] [browser_subdialogs.js]
@@ -141,7 +150,3 @@ support-files =
[browser_sync_disabled.js] [browser_sync_disabled.js]
[browser_sync_pairing.js] [browser_sync_pairing.js]
[browser_warning_permanent_private_browsing.js] [browser_warning_permanent_private_browsing.js]
[browser_containers_name_input.js]
[browser_fluent.js]
[browser_hometab_restore_defaults.js]
https_first_disabled = true

View File

@@ -0,0 +1,54 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Tests the "Import Data" button in the "Import Browser Data" section of
* the General pane of about:preferences launches the Migration Wizard.
*/
add_task(async function test_open_migration_wizard() {
const BUTTON_ID = "data-migration";
await BrowserTestUtils.withNewTab(
{ gBrowser, url: "about:preferences#general" },
async function(browser) {
let button = browser.contentDocument.getElementById(BUTTON_ID);
// First, we'll test the legacy Migration Wizard.
await SpecialPowers.pushPrefEnv({
set: [["browser.migrate.content-modal.enabled", false]],
});
let migrationWizardWindow = BrowserTestUtils.domWindowOpenedAndLoaded(
null,
win => {
let type = win.document.documentElement.getAttribute("windowtype");
if (type == "Browser:MigrationWizard") {
Assert.ok(true, "Saw legacy Migration Wizard window open.");
return true;
}
return false;
}
);
button.click();
let win = await migrationWizardWindow;
await BrowserTestUtils.closeWindow(win);
// Next, we'll test the new Migration Wizard.
await SpecialPowers.pushPrefEnv({
set: [["browser.migrate.content-modal.enabled", true]],
});
let wizardReady = BrowserTestUtils.waitForEvent(
browser.contentWindow,
"MigrationWizard:Ready"
);
button.click();
await wizardReady;
Assert.ok(true, "Saw the new Migration Wizard dialog open.");
}
);
});

View File

@@ -111,7 +111,8 @@ add_task(async function search_for_password_show_passwordGroup() {
child.id == "weavePrefsDeck" || child.id == "weavePrefsDeck" ||
child.id == "header-searchResults" || child.id == "header-searchResults" ||
child.id == "certSelection" || child.id == "certSelection" ||
child.id == "connectionGroup" child.id == "connectionGroup" ||
child.id == "dataMigrationGroup"
) { ) {
is_element_visible(child, "Should be in search results"); is_element_visible(child, "Should be in search results");
} else if (child.id) { } else if (child.id) {
@@ -151,6 +152,7 @@ add_task(async function search_for_password_show_passwordGroup() {
"performanceCategory", "performanceCategory",
"browsingCategory", "browsingCategory",
"networkProxyCategory", "networkProxyCategory",
"dataMigrationGroup",
]; ];
// Only visible for non-MSIX builds // Only visible for non-MSIX builds
if ( if (

View File

@@ -149,6 +149,12 @@ startup-restore-warn-on-quit =
disable-extension = disable-extension =
.label = Disable Extension .label = Disable Extension
preferences-data-migration-header = Import Browser Data
preferences-data-migration-description = Import bookmarks, passwords, history and autofill data from a different browser or a password manager into { -brand-short-name }.
preferences-data-migration-button =
.label = Import Data
.accesskey = m
tabs-group-header = Tabs tabs-group-header = Tabs
ctrl-tab-recently-used-order = ctrl-tab-recently-used-order =