Commit fbeede40 authored by henry's avatar henry Committed by Pier Angelo Vendrame
Browse files

BB 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 31f63bbf
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -21,8 +21,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";

@@ -47,12 +47,21 @@ nsresult ProfileResetCleanup(nsToolkitProfileService* aService,
      mozilla::components::StringBundle::Service();
  if (!sbs) return NS_ERROR_FAILURE;

  nsCOMPtr<nsIStringBundle> brandBundle;
  (void)sbs->CreateBundle(kBrandProperties, getter_AddRefs(brandBundle));
  if (!brandBundle) return NS_ERROR_FAILURE;

  nsCOMPtr<nsIStringBundle> sb;
  (void)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;

+23 −4
Original line number Diff line number Diff line
@@ -2668,6 +2668,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";

@@ -2741,12 +2743,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(sb, 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;
@@ -2810,12 +2820,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