Skip to content
Snippets Groups Projects
Verified Commit 641655fa authored by henry's avatar henry Committed by Pier Angelo Vendrame
Browse files

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.
parent 291acbab
Branches
Tags
No related merge requests found
......@@ -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;
......
......
......@@ -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
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment