Refactor welcome screen migration logic and remove unused patch file

This commit is contained in:
mr. M
2025-02-16 22:43:57 +01:00
parent e38edc1be0
commit 948abc60d4
3 changed files with 25 additions and 43 deletions

2
l10n

Submodule l10n updated: fc96ddf3c6...c7fc158cf9

View File

@@ -155,8 +155,8 @@
if (this._currentPage !== -1) {
const previousPage = this._pages[this._currentPage];
await Promise.all([this.fadeOutTitles(), this.fadeOutButtons(), this.fadeOutContent()]);
await previousPage.fadeOut();
document.getElementById('zen-welcome-page-content').innerHTML = '';
previousPage.fadeOut();
}
this._currentPage++;
const currentPage = this._pages[this._currentPage];
@@ -181,6 +181,7 @@
element.style.removeProperty('display');
}
await animate('#browser > *', { opacity: [0, 1] });
gZenUIManager.showToast('zen-welcome-finished');
}
async animHeart() {
@@ -195,7 +196,7 @@
{
duration: 1.5,
delay: 0.2,
bounce: 0
bounce: 0,
}
);
}
@@ -220,8 +221,12 @@
l10n: 'zen-welcome-import-button',
onclick: async () => {
MigrationUtils.showMigrationWizard(window, {
zenBlocking: true,
isStartupMigration: true,
});
document.querySelector('#zen-welcome-page-sidebar-buttons button').remove();
const newButton = document.querySelector('#zen-welcome-page-sidebar-buttons button');
newButton.setAttribute('primary', 'true');
document.l10n.setAttributes(newButton, 'zen-welcome-next-action');
return false;
},
},
@@ -246,7 +251,22 @@
const fragment = window.MozXULElement.parseXULToFragment(xul);
document.getElementById('zen-welcome-page-content').appendChild(fragment);
},
fadeOut() {},
async fadeOut() {
const shouldSetDefault = document.getElementById('zen-welcome-set-default-browser').checked;
if (AppConstants.HAVE_SHELL_SERVICE && shouldSetDefault) {
let shellSvc = getShellService();
if (!shellSvc) {
return;
}
try {
await shellSvc.setDefaultBrowser(false);
} catch (ex) {
console.error(ex);
return;
}
}
},
},
{
text: [

View File

@@ -1,38 +0,0 @@
diff --git a/browser/components/migration/MigrationUtils.sys.mjs b/browser/components/migration/MigrationUtils.sys.mjs
index 000b471ee6c93815dde61127b8974774d0abafb1..32ba8d40bab5e609fc76dfe97a952d5a7a300a71 100644
--- a/browser/components/migration/MigrationUtils.sys.mjs
+++ b/browser/components/migration/MigrationUtils.sys.mjs
@@ -576,12 +576,15 @@ class MigrationUtils {
* True if the source selection page of the wizard should be skipped.
* @param {string} [aOptions.profileId]
* An identifier for the profile to use when migrating.
+ * @param {boolean} [aOptions.zenBlocking=false]
+ * True if the migration wizard should block the main thread.
* @returns {Promise<undefined>}
* If an about:preferences tab can be opened, this will resolve when
* that tab has been switched to. Otherwise, this will resolve
* just after opening the top-level dialog window.
*/
showMigrationWizard(aOpener, aOptions) {
+ let zenShouldBlock = aOptions.zenBlocking || false;
// 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
@@ -648,7 +651,7 @@ class MigrationUtils {
if (aboutWelcomeBehavior == "autoclose") {
return aOpener.openPreferences("general-migrate-autoclose");
} else if (aboutWelcomeBehavior == "standalone") {
- openStandaloneWindow(false /* blocking */);
+ openStandaloneWindow(zenShouldBlock /* blocking */);
return Promise.resolve();
}
}
@@ -657,7 +660,7 @@ class MigrationUtils {
// If somehow we failed to open about:preferences, fall back to opening
// the top-level window.
- openStandaloneWindow(false /* blocking */);
+ openStandaloneWindow(zenShouldBlock /* blocking */);
return Promise.resolve();
}