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

@@ -10,6 +10,7 @@
ChromeUtils.defineESModuleGetters(this, {
BackgroundUpdate: "resource://gre/modules/BackgroundUpdate.sys.mjs",
MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs",
});
// Constants & Enumeration Values
@@ -472,6 +473,11 @@ var gMainPane = {
"command",
gMainPane.showContainerSettings
);
setEventListener(
"data-migration",
"command",
gMainPane.onMigrationButtonCommand
);
// 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
@@ -1713,6 +1719,26 @@ var gMainPane = {
})().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.
*/