[tor-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-128.4.0esr-14.5-1] Bug 42739: Use the brand name for profile error messages.
Pier Angelo Vendrame (@pierov)
git at gitlab.torproject.org
Wed Oct 30 07:30:35 UTC 2024
Pier Angelo Vendrame pushed to branch mullvad-browser-128.4.0esr-14.5-1 at The Tor Project / Applications / Mullvad Browser
Commits:
641655fa by Henry Wilkes at 2024-10-30T08:30:02+01:00
Bug 42739: Use the brand name for profile error messages.
Some messages in profileSelection.properties use gAppData->name as
variable inputs. However, gAppData->name is still "Firefox" for our
base-browser builds, rather than the user-facing browser name. We swap
these instances with the displayed brand name instead.
- - - - -
2 changed files:
- toolkit/xre/ProfileReset.cpp
- toolkit/xre/nsAppRunner.cpp
Changes:
=====================================
toolkit/xre/ProfileReset.cpp
=====================================
@@ -23,8 +23,8 @@
using namespace mozilla;
-extern const XREAppData* gAppData;
-
+static const char kBrandProperties[] =
+ "chrome://branding/locale/brand.properties";
static const char kProfileProperties[] =
"chrome://mozapps/locale/profile/profileSelection.properties";
@@ -49,12 +49,21 @@ nsresult ProfileResetCleanup(nsToolkitProfileService* aService,
mozilla::components::StringBundle::Service();
if (!sbs) return NS_ERROR_FAILURE;
+ nsCOMPtr<nsIStringBundle> brandBundle;
+ Unused << sbs->CreateBundle(kBrandProperties, getter_AddRefs(brandBundle));
+ if (!brandBundle) return NS_ERROR_FAILURE;
+
nsCOMPtr<nsIStringBundle> sb;
Unused << sbs->CreateBundle(kProfileProperties, getter_AddRefs(sb));
if (!sb) return NS_ERROR_FAILURE;
- NS_ConvertUTF8toUTF16 appName(gAppData->name);
- AutoTArray<nsString, 2> params = {appName, appName};
+ nsAutoString appName;
+ rv = brandBundle->GetStringFromName("brandShortName", appName);
+ if (NS_FAILED(rv)) return rv;
+
+ AutoTArray<nsString, 2> params;
+ params.AppendElement(appName);
+ params.AppendElement(appName);
nsAutoString resetBackupDirectoryName;
=====================================
toolkit/xre/nsAppRunner.cpp
=====================================
@@ -2597,6 +2597,8 @@ nsresult LaunchChild(bool aBlankCommandLine, bool aTryExec) {
return NS_ERROR_LAUNCHED_CHILD_PROCESS;
}
+static const char kBrandProperties[] =
+ "chrome://branding/locale/brand.properties";
static const char kProfileProperties[] =
"chrome://mozapps/locale/profile/profileSelection.properties";
@@ -2666,12 +2668,20 @@ static nsresult ProfileMissingDialog(nsINativeAppSupport* aNative) {
mozilla::components::StringBundle::Service();
NS_ENSURE_TRUE(sbs, NS_ERROR_FAILURE);
+ nsCOMPtr<nsIStringBundle> brandBundle;
+ sbs->CreateBundle(kBrandProperties, getter_AddRefs(brandBundle));
+ NS_ENSURE_TRUE_LOG(sbs, NS_ERROR_FAILURE);
nsCOMPtr<nsIStringBundle> sb;
sbs->CreateBundle(kProfileProperties, getter_AddRefs(sb));
NS_ENSURE_TRUE_LOG(sbs, NS_ERROR_FAILURE);
- NS_ConvertUTF8toUTF16 appName(gAppData->name);
- AutoTArray<nsString, 2> params = {appName, appName};
+ nsAutoString appName;
+ rv = brandBundle->GetStringFromName("brandShortName", appName);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_ABORT);
+
+ AutoTArray<nsString, 2> params;
+ params.AppendElement(appName);
+ params.AppendElement(appName);
// profileMissing
nsAutoString missingMessage;
@@ -2733,12 +2743,21 @@ static ReturnAbortOnError ProfileLockedDialog(nsIFile* aProfileDir,
mozilla::components::StringBundle::Service();
NS_ENSURE_TRUE(sbs, NS_ERROR_FAILURE);
+ nsCOMPtr<nsIStringBundle> brandBundle;
+ sbs->CreateBundle(kBrandProperties, getter_AddRefs(brandBundle));
+ NS_ENSURE_TRUE_LOG(sbs, NS_ERROR_FAILURE);
nsCOMPtr<nsIStringBundle> sb;
sbs->CreateBundle(kProfileProperties, getter_AddRefs(sb));
NS_ENSURE_TRUE_LOG(sbs, NS_ERROR_FAILURE);
- NS_ConvertUTF8toUTF16 appName(gAppData->name);
- AutoTArray<nsString, 3> params = {appName, appName, appName};
+ nsAutoString appName;
+ rv = brandBundle->GetStringFromName("brandShortName", appName);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_ABORT);
+
+ AutoTArray<nsString, 3> params;
+ params.AppendElement(appName);
+ params.AppendElement(appName);
+ params.AppendElement(appName);
nsAutoString killMessage;
#ifndef XP_MACOSX
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/641655fab9ccfab54044697e1ca8430bc1d78f5f
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/641655fab9ccfab54044697e1ca8430bc1d78f5f
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tor-commits/attachments/20241030/94f1b3b6/attachment-0001.htm>
More information about the tor-commits
mailing list