Bug 1838507 - Default the about:welcome migration behaviour to the legacy XUL dialog. r=Mardak

This adds a new behaviour that opens the legacy migration wizard from about:welcome,
and sets the pref to default to that behaviour.

This also adds the behaviour to the FeatureManifest.yaml file so that it can be
instrumented remotely via Nimbus.

Differential Revision: https://phabricator.services.mozilla.com/D181105
This commit is contained in:
Mike Conley
2023-06-15 16:33:43 +00:00
parent 667509aeb7
commit fededa4b9c
6 changed files with 101 additions and 38 deletions

View File

@@ -589,8 +589,43 @@ class MigrationUtils {
* just after opening the dialog window.
*/
showMigrationWizard(aOpener, aOptions) {
// When migration is kicked off from about:welcome, there are
// a few different behaviors that we want to test, controlled
// by a preference that is instrumented for Nimbus. The pref
// has the following possible states:
//
// "autoclose":
// The user will be directed to the migration wizard in
// about:preferences, but once the wizard is dismissed,
// the tab will close.
//
// "standalone":
// The migration wizard will open in a new top-level content
// window.
//
// "legacy":
// The legacy migration wizard will open, even if the new migration
// wizard is enabled by default.
//
// "default" / other
// The user will be directed to the migration wizard in
// about:preferences. The tab will not close once the
// user closes the wizard.
let aboutWelcomeBehavior = Services.prefs.getCharPref(
"browser.migrate.content-modal.about-welcome-behavior",
"default"
);
let aboutWelcomeLegacyBehavior =
aboutWelcomeBehavior == "legacy" &&
aOptions.entrypoint == this.MIGRATION_ENTRYPOINTS.NEWTAB;
if (
Services.prefs.getBoolPref("browser.migrate.content-modal.enabled", false)
Services.prefs.getBoolPref(
"browser.migrate.content-modal.enabled",
false
) &&
!aboutWelcomeLegacyBehavior
) {
let entrypoint =
aOptions.entrypoint || this.MIGRATION_ENTRYPOINTS.UNKNOWN;
@@ -633,29 +668,6 @@ class MigrationUtils {
if (aOpener?.openPreferences) {
if (aOptions.entrypoint == this.MIGRATION_ENTRYPOINTS.NEWTAB) {
// When migration is kicked off from about:welcome, there are
// a few different behaviors that we want to test, controlled
// by a preference that is instrumented for Nimbus. The pref
// has the following possible states:
//
// "autoclose":
// The user will be directed to the migration wizard in
// about:preferences, but once the wizard is dismissed,
// the tab will close.
//
// "standalone":
// The migration wizard will open in a new top-level content
// window.
//
// "default" / other
// The user will be directed to the migration wizard in
// about:preferences. The tab will not close once the
// user closes the wizard.
let aboutWelcomeBehavior = Services.prefs.getCharPref(
"browser.migrate.content-modal.about-welcome-behavior",
"default"
);
if (aboutWelcomeBehavior == "autoclose") {
return aOpener.openPreferences("general-migrate-autoclose");
} else if (aboutWelcomeBehavior == "standalone") {