Bug 1581537 - Avoid several browser language leaks r=smaug

Spoof dom/dom.properties, layout/xmlparser.properties,
layout/MediaDocument.properties to en-US if needed.

Differential Revision: https://phabricator.services.mozilla.com/D46034
This commit is contained in:
Alex Catarineu
2019-11-04 16:56:27 +00:00
parent 4f87b88cc6
commit 65042da62b
26 changed files with 296 additions and 149 deletions

View File

@@ -742,15 +742,16 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) {
nsAutoString title;
nsAutoString okButtonLabel;
if (aType == FILE_PICKER_DIRECTORY) {
nsContentUtils::GetLocalizedString(
nsContentUtils::eFORMS_PROPERTIES_MAYBESPOOF, "DirectoryUpload", title);
nsContentUtils::GetMaybeLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"DirectoryUpload", OwnerDoc(),
title);
nsContentUtils::GetLocalizedString(
nsContentUtils::eFORMS_PROPERTIES_MAYBESPOOF,
"DirectoryPickerOkButtonLabel", okButtonLabel);
nsContentUtils::GetMaybeLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"DirectoryPickerOkButtonLabel",
OwnerDoc(), okButtonLabel);
} else {
nsContentUtils::GetLocalizedString(
nsContentUtils::eFORMS_PROPERTIES_MAYBESPOOF, "FileUpload", title);
nsContentUtils::GetMaybeLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"FileUpload", OwnerDoc(), title);
}
nsCOMPtr<nsIFilePicker> filePicker =
@@ -2366,23 +2367,24 @@ void HTMLInputElement::GetDisplayFileName(nsAString& aValue) const {
if ((StaticPrefs::dom_input_dirpicker() && Allowdirs()) ||
(StaticPrefs::dom_webkitBlink_dirPicker_enabled() &&
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
nsContentUtils::GetLocalizedString(
nsContentUtils::eFORMS_PROPERTIES_MAYBESPOOF, "NoDirSelected", value);
nsContentUtils::GetMaybeLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"NoDirSelected", OwnerDoc(),
value);
} else if (HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)) {
nsContentUtils::GetLocalizedString(
nsContentUtils::eFORMS_PROPERTIES_MAYBESPOOF, "NoFilesSelected",
value);
nsContentUtils::GetMaybeLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"NoFilesSelected", OwnerDoc(),
value);
} else {
nsContentUtils::GetLocalizedString(
nsContentUtils::eFORMS_PROPERTIES_MAYBESPOOF, "NoFileSelected",
value);
nsContentUtils::GetMaybeLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"NoFileSelected", OwnerDoc(),
value);
}
} else {
nsString count;
count.AppendInt(int(mFileData->mFilesOrDirectories.Length()));
nsContentUtils::FormatLocalizedString(
value, nsContentUtils::eFORMS_PROPERTIES_MAYBESPOOF, "XFilesSelected",
nsContentUtils::FormatMaybeLocalizedString(
value, nsContentUtils::eFORMS_PROPERTIES, "XFilesSelected", OwnerDoc(),
count);
}
@@ -5819,8 +5821,8 @@ HTMLInputElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission) {
!HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
// Get our default value, which is the same as our default label
nsAutoString defaultValue;
nsContentUtils::GetLocalizedString(
nsContentUtils::eFORMS_PROPERTIES_MAYBESPOOF, "Submit", defaultValue);
nsContentUtils::GetMaybeLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"Submit", OwnerDoc(), defaultValue);
value = defaultValue;
}