
Pier Angelo Vendrame pushed to branch mullvad-browser-140.2.0esr-15.0-1 at The Tor Project / Applications / Mullvad Browser Commits: a5709ed4 by Pier Angelo Vendrame at 2025-09-08T16:07:32+02:00 fixup! MB 419: Mullvad Browser migration procedures. BB 43770: Follow upstream's BrowserGlue simplifications. - - - - - 2 changed files: - browser/components/BrowserGlue.sys.mjs - browser/components/ProfileDataUpgrader.sys.mjs Changes: ===================================== browser/components/BrowserGlue.sys.mjs ===================================== @@ -430,9 +430,7 @@ BrowserGlue.prototype = { // handle any UI migration this._migrateUI(); lazy.ProfileDataUpgrader.upgradeBB(this._isNewProfile); - - // Mullvad Browser-specific version of _migrateUI. - this._migrateUIMB(); + lazy.ProfileDataUpgrader.upgradeMB(this._isNewProfile); if (!Services.prefs.prefHasUserValue(PREF_PDFJS_ISDEFAULT_CACHE_STATE)) { lazy.PdfJs.checkIsDefault(this._isNewProfile); @@ -1654,58 +1652,6 @@ BrowserGlue.prototype = { } }, - // Use this method for any MB migration that can be run just before showing - // the UI. - // Anything that critically needs to be migrated earlier should not use this. - async _migrateUIMB() { - // Version 1: Mullvad Browser 14.5a6: Clear home page update url preference - // (mullvad-browser#411). - // Version 2: Mullvad Browser 15.0a2: Remove legacy search addons - // (tor-browser#43111). - const MB_MIGRATION_VERSION = 2; - const MIGRATION_PREF = "mullvadbrowser.migration.version"; - - // If we decide to force updating users to pass through any version - // following 14.5, we can remove this check, and check only whether - // MIGRATION_PREF has a user value, like Mozilla does. - if (this._isNewProfile) { - // Do not migrate fresh profiles - Services.prefs.setIntPref(MIGRATION_PREF, MB_MIGRATION_VERSION); - return; - } else if (this._isNewProfile === undefined) { - // If this happens, check if upstream updated their function and do not - // set this member anymore! - console.error("_migrateUIMB: this._isNewProfile is undefined."); - } - - const currentVersion = Services.prefs.getIntPref(MIGRATION_PREF, 0); - - if (currentVersion < 1) { - Services.prefs.clearUserPref("mullvadbrowser.post_update.url"); - } - const dropAddons = async list => { - for (const id of list) { - try { - const engine = await lazy.AddonManager.getAddonByID(id); - await engine?.uninstall(); - } catch {} - } - }; - if (currentVersion < 2) { - await dropAddons([ - "brave@search.mozilla.org", - "ddg@search.mozilla.org", - "ddg-html@search.mozilla.org", - "metager@search.mozilla.org", - "mojeek@search.mozilla.org", - "mullvad-leta@search.mozilla.org", - "startpage@search.mozilla.org", - ]); - } - - Services.prefs.setIntPref(MIGRATION_PREF, MB_MIGRATION_VERSION); - }, - async _showUpgradeDialog() { const data = await lazy.OnboardingMessageProvider.getUpgradeMessage(); const { gBrowser } = lazy.BrowserWindowTracker.getTopWindow(); ===================================== browser/components/ProfileDataUpgrader.sys.mjs ===================================== @@ -974,4 +974,50 @@ export let ProfileDataUpgrader = { } Services.prefs.setIntPref(MIGRATION_PREF, MIGRATION_VERSION); }, + + async upgradeMB(isNewProfile) { + // Version 1: Mullvad Browser 14.5a6: Clear home page update url preference + // (mullvad-browser#411). + // Version 2: Mullvad Browser 15.0a2: Remove legacy search addons + // (tor-browser#43111). + const MB_MIGRATION_VERSION = 2; + const MIGRATION_PREF = "mullvadbrowser.migration.version"; + + if (isNewProfile) { + // Do not migrate fresh profiles + Services.prefs.setIntPref(MIGRATION_PREF, MB_MIGRATION_VERSION); + return; + } else if (isNewProfile === undefined) { + // If this happens, check if upstream updated their function and do not + // set this member anymore! + console.error("upgradeTB: isNewProfile is undefined."); + } + + const currentVersion = Services.prefs.getIntPref(MIGRATION_PREF, 0); + + if (currentVersion < 1) { + Services.prefs.clearUserPref("mullvadbrowser.post_update.url"); + } + const dropAddons = async list => { + for (const id of list) { + try { + const engine = await lazy.AddonManager.getAddonByID(id); + await engine?.uninstall(); + } catch {} + } + }; + if (currentVersion < 2) { + await dropAddons([ + "brave@search.mozilla.org", + "ddg@search.mozilla.org", + "ddg-html@search.mozilla.org", + "metager@search.mozilla.org", + "mojeek@search.mozilla.org", + "mullvad-leta@search.mozilla.org", + "startpage@search.mozilla.org", + ]); + } + + Services.prefs.setIntPref(MIGRATION_PREF, MB_MIGRATION_VERSION); + }, }; View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/a570... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/a570... You're receiving this email because of your account on gitlab.torproject.org.