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
-
ca49f66b
by Henry Wilkes at 2025-04-08T20:09:01+01:00
-
02beae18
by Henry Wilkes at 2025-04-08T20:09:02+01:00
-
e0823401
by Henry Wilkes at 2025-04-08T20:38:19+01:00
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:
| ... | ... | @@ -4,7 +4,11 @@ |
| 4 | 4 | |
| 5 | 5 | // This file contains branding-specific prefs.
|
| 6 | 6 | |
| 7 | -pref("startup.homepage_override_url", "");
|
|
| 7 | +// startup.homepage_override_url is used in about:mullvad-browser after an
|
|
| 8 | +// update because app.releaseNotesURL.aboutDialog is about:blank for mb-nightly.
|
|
| 9 | +// I.e. we want the update to show in about:mullvad-browser, whilst it is not
|
|
| 10 | +// shown in the about dialog. See mullvad-browser#411.
|
|
| 11 | +pref("startup.homepage_override_url", "https://nightlies.tbb.torproject.org/");
|
|
| 8 | 12 | // app.update.url.manual: URL user can browse to manually if for some reason
|
| 9 | 13 | // all update installation attempts fail.
|
| 10 | 14 | // app.update.url.details: a default value for the "More information about this
|
| ... | ... | @@ -876,18 +876,19 @@ nsBrowserContentHandler.prototype = { |
| 876 | 876 | "%OLD_BASE_BROWSER_VERSION%",
|
| 877 | 877 | old_forkVersion
|
| 878 | 878 | );
|
| 879 | - if (overridePage && AppConstants.BASE_BROWSER_UPDATE) {
|
|
| 879 | + if (AppConstants.BASE_BROWSER_UPDATE) {
|
|
| 880 | + // NOTE: We ignore any overridePage value, which can come from the
|
|
| 881 | + // openURL attribute within the updates.xml file.
|
|
| 880 | 882 | // Mullvad Browser, copied from tor-browser: Instead of opening
|
| 881 | 883 | // the post-update "override page" directly, we include a link in
|
| 882 | 884 | // about:mullvad-browser.
|
| 883 | - prefb.setCharPref("mullvadbrowser.post_update.url", overridePage);
|
|
| 884 | 885 | prefb.setBoolPref(
|
| 885 | 886 | "mullvadbrowser.post_update.shouldNotify",
|
| 886 | 887 | true
|
| 887 | 888 | );
|
| 888 | - // If the user's homepage is about:tor, we will inform them
|
|
| 889 | - // about the update on that page; otherwise, we arrange to
|
|
| 890 | - // open about:tor in a secondary tab.
|
|
| 889 | + // If the user's homepage is about:mullvad-browser, we will inform
|
|
| 890 | + // them about the update on that page; otherwise, we arrange to
|
|
| 891 | + // open about:mullvad-browser in a secondary tab.
|
|
| 891 | 892 | overridePage =
|
| 892 | 893 | startPage === "about:mullvad-browser"
|
| 893 | 894 | ? ""
|
| ... | ... | @@ -1515,6 +1515,9 @@ BrowserGlue.prototype = { |
| 1515 | 1515 | // Base Browser-specific version of _migrateUI.
|
| 1516 | 1516 | this._migrateUIBB();
|
| 1517 | 1517 | |
| 1518 | + // Mullvad Browser-specific version of _migrateUI.
|
|
| 1519 | + this._migrateUIMB();
|
|
| 1520 | + |
|
| 1518 | 1521 | if (!Services.prefs.prefHasUserValue(PREF_PDFJS_ISDEFAULT_CACHE_STATE)) {
|
| 1519 | 1522 | lazy.PdfJs.checkIsDefault(this._isNewProfile);
|
| 1520 | 1523 | }
|
| ... | ... | @@ -4694,6 +4697,37 @@ BrowserGlue.prototype = { |
| 4694 | 4697 | Services.prefs.setIntPref(MIGRATION_PREF, MIGRATION_VERSION);
|
| 4695 | 4698 | },
|
| 4696 | 4699 | |
| 4700 | + // Use this method for any MB migration that can be run just before showing
|
|
| 4701 | + // the UI.
|
|
| 4702 | + // Anything that critically needs to be migrated earlier should not use this.
|
|
| 4703 | + _migrateUIMB() {
|
|
| 4704 | + // Version 1: Mullvad Browser 14.5a6: Clear home page update url preference
|
|
| 4705 | + // (mullvad-browser#411).
|
|
| 4706 | + const MB_MIGRATION_VERSION = 1;
|
|
| 4707 | + const MIGRATION_PREF = "mullvadbrowser.migration.version";
|
|
| 4708 | + |
|
| 4709 | + // If we decide to force updating users to pass through any version
|
|
| 4710 | + // following 14.5, we can remove this check, and check only whether
|
|
| 4711 | + // MIGRATION_PREF has a user value, like Mozilla does.
|
|
| 4712 | + if (this._isNewProfile) {
|
|
| 4713 | + // Do not migrate fresh profiles
|
|
| 4714 | + Services.prefs.setIntPref(MIGRATION_PREF, MB_MIGRATION_VERSION);
|
|
| 4715 | + return;
|
|
| 4716 | + } else if (this._isNewProfile === undefined) {
|
|
| 4717 | + // If this happens, check if upstream updated their function and do not
|
|
| 4718 | + // set this member anymore!
|
|
| 4719 | + console.error("_migrateUIMB: this._isNewProfile is undefined.");
|
|
| 4720 | + }
|
|
| 4721 | + |
|
| 4722 | + const currentVersion = Services.prefs.getIntPref(MIGRATION_PREF, 0);
|
|
| 4723 | + |
|
| 4724 | + if (currentVersion < 1) {
|
|
| 4725 | + Services.prefs.clearUserPref("mullvadbrowser.post_update.url");
|
|
| 4726 | + }
|
|
| 4727 | + |
|
| 4728 | + Services.prefs.setIntPref(MIGRATION_PREF, MB_MIGRATION_VERSION);
|
|
| 4729 | + },
|
|
| 4730 | + |
|
| 4697 | 4731 | async _showUpgradeDialog() {
|
| 4698 | 4732 | const data = await lazy.OnboardingMessageProvider.getUpgradeMessage();
|
| 4699 | 4733 | const { gBrowser } = lazy.BrowserWindowTracker.getTopWindow();
|
| ... | ... | @@ -5,21 +5,28 @@ export class AboutMullvadBrowserParent extends JSWindowActorParent { |
| 5 | 5 | receiveMessage(message) {
|
| 6 | 6 | const shouldNotifyPref = "mullvadbrowser.post_update.shouldNotify";
|
| 7 | 7 | switch (message.name) {
|
| 8 | - case "AboutMullvadBrowser:GetUpdateData":
|
|
| 8 | + case "AboutMullvadBrowser:GetUpdateData": {
|
|
| 9 | 9 | if (!Services.prefs.getBoolPref(shouldNotifyPref, false)) {
|
| 10 | 10 | return Promise.resolve(null);
|
| 11 | 11 | }
|
| 12 | 12 | Services.prefs.clearUserPref(shouldNotifyPref);
|
| 13 | + // Try use the same URL as the about dialog. See mullvad-browser#411.
|
|
| 14 | + let updateURL = Services.urlFormatter.formatURLPref(
|
|
| 15 | + "app.releaseNotesURL.aboutDialog"
|
|
| 16 | + );
|
|
| 17 | + if (updateURL === "about:blank") {
|
|
| 18 | + updateURL = Services.urlFormatter.formatURLPref(
|
|
| 19 | + "startup.homepage_override_url"
|
|
| 20 | + );
|
|
| 21 | + }
|
|
| 22 | + |
|
| 13 | 23 | return Promise.resolve({
|
| 14 | 24 | version: Services.prefs.getCharPref(
|
| 15 | 25 | "browser.startup.homepage_override.mullvadbrowser.version"
|
| 16 | 26 | ),
|
| 17 | - url:
|
|
| 18 | - Services.prefs.getCharPref("mullvadbrowser.post_update.url", "") ||
|
|
| 19 | - Services.urlFormatter.formatURLPref(
|
|
| 20 | - "startup.homepage_override_url"
|
|
| 21 | - ),
|
|
| 27 | + url: updateURL,
|
|
| 22 | 28 | });
|
| 29 | + }
|
|
| 23 | 30 | }
|
| 24 | 31 | return undefined;
|
| 25 | 32 | }
|