morgan pushed to branch mullvad-browser-128.9.0esr-14.5-1 at The Tor Project / Applications / Mullvad Browser
Commits: 9762aa0d by Henry Wilkes at 2025-04-08T20:09:01+01:00 fixup! MB 112: Updater customization for Mullvad Browser
MB 411: Drop mullvadbrowser.post_update.url.
Also, no longer require an override page to be set to open about:mullvad-browser after an update.
- - - - - ca49f66b by Henry Wilkes at 2025-04-08T20:09:01+01:00 fixup! MB 39: Add home page about:mullvad-browser
MB 411: Use the same update URL in about:mullvad-browser as the about dialog.
- - - - - 02beae18 by Henry Wilkes at 2025-04-08T20:09:02+01:00 MB 419: Mullvad Browser migration procedures.
This commit implements the the Mullvad Browser's version of _migrateUI.
- - - - - e0823401 by Henry Wilkes at 2025-04-08T20:38:19+01:00 fixup! MB 1: Mullvad Browser branding
MB 411: Set startup.homepage_override_url on mb-nightly to be used instead of app.releaseNotesURL.aboutDialog.
- - - - -
4 changed files:
- browser/branding/mb-nightly/pref/firefox-branding.js - browser/components/BrowserContentHandler.sys.mjs - browser/components/BrowserGlue.sys.mjs - browser/components/mullvad-browser/AboutMullvadBrowserParent.sys.mjs
Changes:
===================================== browser/branding/mb-nightly/pref/firefox-branding.js ===================================== @@ -4,7 +4,11 @@
// This file contains branding-specific prefs.
-pref("startup.homepage_override_url", ""); +// startup.homepage_override_url is used in about:mullvad-browser after an +// update because app.releaseNotesURL.aboutDialog is about:blank for mb-nightly. +// I.e. we want the update to show in about:mullvad-browser, whilst it is not +// shown in the about dialog. See mullvad-browser#411. +pref("startup.homepage_override_url", "https://nightlies.tbb.torproject.org/"); // app.update.url.manual: URL user can browse to manually if for some reason // all update installation attempts fail. // app.update.url.details: a default value for the "More information about this
===================================== browser/components/BrowserContentHandler.sys.mjs ===================================== @@ -876,18 +876,19 @@ nsBrowserContentHandler.prototype = { "%OLD_BASE_BROWSER_VERSION%", old_forkVersion ); - if (overridePage && AppConstants.BASE_BROWSER_UPDATE) { + if (AppConstants.BASE_BROWSER_UPDATE) { + // NOTE: We ignore any overridePage value, which can come from the + // openURL attribute within the updates.xml file. // Mullvad Browser, copied from tor-browser: Instead of opening // the post-update "override page" directly, we include a link in // about:mullvad-browser. - prefb.setCharPref("mullvadbrowser.post_update.url", overridePage); prefb.setBoolPref( "mullvadbrowser.post_update.shouldNotify", true ); - // If the user's homepage is about:tor, we will inform them - // about the update on that page; otherwise, we arrange to - // open about:tor in a secondary tab. + // If the user's homepage is about:mullvad-browser, we will inform + // them about the update on that page; otherwise, we arrange to + // open about:mullvad-browser in a secondary tab. overridePage = startPage === "about:mullvad-browser" ? ""
===================================== browser/components/BrowserGlue.sys.mjs ===================================== @@ -1515,6 +1515,9 @@ BrowserGlue.prototype = { // Base Browser-specific version of _migrateUI. this._migrateUIBB();
+ // Mullvad Browser-specific version of _migrateUI. + this._migrateUIMB(); + if (!Services.prefs.prefHasUserValue(PREF_PDFJS_ISDEFAULT_CACHE_STATE)) { lazy.PdfJs.checkIsDefault(this._isNewProfile); } @@ -4694,6 +4697,37 @@ BrowserGlue.prototype = { Services.prefs.setIntPref(MIGRATION_PREF, MIGRATION_VERSION); },
+ // 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. + _migrateUIMB() { + // Version 1: Mullvad Browser 14.5a6: Clear home page update url preference + // (mullvad-browser#411). + const MB_MIGRATION_VERSION = 1; + 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"); + } + + Services.prefs.setIntPref(MIGRATION_PREF, MB_MIGRATION_VERSION); + }, + async _showUpgradeDialog() { const data = await lazy.OnboardingMessageProvider.getUpgradeMessage(); const { gBrowser } = lazy.BrowserWindowTracker.getTopWindow();
===================================== browser/components/mullvad-browser/AboutMullvadBrowserParent.sys.mjs ===================================== @@ -5,21 +5,28 @@ export class AboutMullvadBrowserParent extends JSWindowActorParent { receiveMessage(message) { const shouldNotifyPref = "mullvadbrowser.post_update.shouldNotify"; switch (message.name) { - case "AboutMullvadBrowser:GetUpdateData": + case "AboutMullvadBrowser:GetUpdateData": { if (!Services.prefs.getBoolPref(shouldNotifyPref, false)) { return Promise.resolve(null); } Services.prefs.clearUserPref(shouldNotifyPref); + // Try use the same URL as the about dialog. See mullvad-browser#411. + let updateURL = Services.urlFormatter.formatURLPref( + "app.releaseNotesURL.aboutDialog" + ); + if (updateURL === "about:blank") { + updateURL = Services.urlFormatter.formatURLPref( + "startup.homepage_override_url" + ); + } + return Promise.resolve({ version: Services.prefs.getCharPref( "browser.startup.homepage_override.mullvadbrowser.version" ), - url: - Services.prefs.getCharPref("mullvadbrowser.post_update.url", "") || - Services.urlFormatter.formatURLPref( - "startup.homepage_override_url" - ), + url: updateURL, }); + } } return undefined; }
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/266...
tbb-commits@lists.torproject.org