[tbb-commits] [tor-browser/tor-browser-68.2.0esr-9.5-1] Revert "Bug 30683: Prevent detection of locale via some *.properties"
gk at torproject.org
gk at torproject.org
Wed Nov 6 21:19:43 UTC 2019
commit cb255f2504b37916160e886a181f1a02f85dba7c
Author: Alex Catarineu <acat at torproject.org>
Date: Tue Nov 5 10:53:21 2019 +0100
Revert "Bug 30683: Prevent detection of locale via some *.properties"
This reverts commit ab53cf71411a60ca56d5f6e24ec118802b8788df.
---
browser/installer/package-manifest.in | 3 ---
dom/base/nsContentUtils.cpp | 17 ++++-------------
dom/base/nsContentUtils.h | 4 ----
dom/html/HTMLSelectElement.cpp | 2 +-
dom/html/HTMLTextAreaElement.cpp | 6 +++---
dom/html/MediaDocument.cpp | 4 +---
dom/html/MediaDocument.h | 3 ---
dom/html/input/CheckableInputTypes.cpp | 4 ++--
dom/html/input/DateTimeInputTypes.cpp | 6 +++---
dom/html/input/FileInputType.cpp | 2 +-
dom/html/input/InputType.cpp | 16 ++++++++--------
dom/html/input/NumericInputTypes.cpp | 8 ++++----
dom/html/input/SingleLineTextInputTypes.cpp | 6 +++---
dom/locales/moz.build | 6 ------
mobile/android/installer/package-manifest.in | 3 ---
parser/htmlparser/nsParserMsgUtils.cpp | 6 ------
parser/htmlparser/nsParserMsgUtils.h | 3 ---
17 files changed, 30 insertions(+), 69 deletions(-)
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
index 1825397678d1..1a2a24f9b5b9 100644
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -345,9 +345,6 @@
@RESPATH@/res/dtd/*
@RESPATH@/res/language.properties
@RESPATH@/res/locale/layout/HtmlForm.properties
- at RESPATH@/res/locale/layout/MediaDocument.properties
- at RESPATH@/res/locale/layout/xmlparser.properties
- at RESPATH@/res/locale/dom/dom.properties
#ifdef XP_MACOSX
@RESPATH@/res/MainMenu.nib/
#endif
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
index cfae3ef224b3..9c60c1befe1e 100644
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -3575,9 +3575,7 @@ static const char* gPropertiesFiles[nsContentUtils::PropertiesFile_COUNT] = {
"chrome://global/locale/security/security.properties",
"chrome://necko/locale/necko.properties",
"chrome://global/locale/layout/HtmlForm.properties",
- "resource://gre/res/locale/layout/HtmlForm.properties",
- "chrome://global/locale/dom/dom.properties",
- "resource://gre/res/locale/dom/dom.properties"};
+ "resource://gre/res/locale/layout/HtmlForm.properties"};
/* static */
nsresult nsContentUtils::EnsureStringBundle(PropertiesFile aFile) {
@@ -3626,8 +3624,7 @@ void nsContentUtils::AsyncPrecreateStringBundles() {
}
}
-/* static */
-bool nsContentUtils::SpoofLocaleEnglish() {
+static bool SpoofLocaleEnglish() {
// 0 - will prompt
// 1 - don't spoof
// 2 - spoof
@@ -3638,12 +3635,9 @@ bool nsContentUtils::SpoofLocaleEnglish() {
nsresult nsContentUtils::GetLocalizedString(PropertiesFile aFile,
const char* aKey,
nsAString& aResult) {
- // When we spoof English, use en-US properties in strings that are accessible
- // by content.
+ // When we spoof English, use en-US default strings in HTML forms.
if (aFile == eFORMS_PROPERTIES_MAYBESPOOF && SpoofLocaleEnglish()) {
aFile = eFORMS_PROPERTIES_en_US;
- } else if (aFile == eDOM_PROPERTIES_MAYBESPOOF && SpoofLocaleEnglish()) {
- aFile = eDOM_PROPERTIES_en_US;
}
nsresult rv = EnsureStringBundle(aFile);
@@ -3658,12 +3652,9 @@ nsresult nsContentUtils::FormatLocalizedString(PropertiesFile aFile,
const char16_t** aParams,
uint32_t aParamsLength,
nsAString& aResult) {
- // When we spoof English, use en-US properties in strings that are accessible
- // by content.
+ // When we spoof English, use en-US default strings in HTML forms.
if (aFile == eFORMS_PROPERTIES_MAYBESPOOF && SpoofLocaleEnglish()) {
aFile = eFORMS_PROPERTIES_en_US;
- } else if (aFile == eDOM_PROPERTIES_MAYBESPOOF && SpoofLocaleEnglish()) {
- aFile = eDOM_PROPERTIES_en_US;
}
nsresult rv = EnsureStringBundle(aFile);
diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h
index 2bf27250e68b..ee23a540871d 100644
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -1119,8 +1119,6 @@ class nsContentUtils {
eNECKO_PROPERTIES,
eFORMS_PROPERTIES_MAYBESPOOF,
eFORMS_PROPERTIES_en_US,
- eDOM_PROPERTIES_MAYBESPOOF,
- eDOM_PROPERTIES_en_US,
PropertiesFile_COUNT
};
static nsresult ReportToConsole(
@@ -1134,8 +1132,6 @@ class nsContentUtils {
static void LogMessageToConsole(const char* aMsg);
- static bool SpoofLocaleEnglish();
-
/**
* Get the localized string named |aKey| in properties file |aFile|.
*/
diff --git a/dom/html/HTMLSelectElement.cpp b/dom/html/HTMLSelectElement.cpp
index afa01ee224ba..76f21db23b31 100644
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -1539,7 +1539,7 @@ nsresult HTMLSelectElement::GetValidationMessage(nsAString& aValidationMessage,
case VALIDITY_STATE_VALUE_MISSING: {
nsAutoString message;
nsresult rv = nsContentUtils::GetLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationSelectMissing",
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationSelectMissing",
message);
aValidationMessage = message;
return rv;
diff --git a/dom/html/HTMLTextAreaElement.cpp b/dom/html/HTMLTextAreaElement.cpp
index 2844267b9bb8..0d1ba35c8b59 100644
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -1001,7 +1001,7 @@ nsresult HTMLTextAreaElement::GetValidationMessage(
const char16_t* params[] = {strMaxLength.get(), strTextLength.get()};
rv = nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationTextTooLong", params,
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationTextTooLong", params,
message);
aValidationMessage = message;
} break;
@@ -1017,13 +1017,13 @@ nsresult HTMLTextAreaElement::GetValidationMessage(
const char16_t* params[] = {strMinLength.get(), strTextLength.get()};
rv = nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationTextTooShort", params,
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationTextTooShort", params,
message);
aValidationMessage = message;
} break;
case VALIDITY_STATE_VALUE_MISSING: {
nsAutoString message;
- rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF,
+ rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationValueMissing",
message);
aValidationMessage = message;
diff --git a/dom/html/MediaDocument.cpp b/dom/html/MediaDocument.cpp
index 7ec66b31e63d..196adddc0f38 100644
--- a/dom/html/MediaDocument.cpp
+++ b/dom/html/MediaDocument.cpp
@@ -125,9 +125,7 @@ nsresult MediaDocument::Init() {
nsCOMPtr<nsIStringBundleService> stringService =
mozilla::services::GetStringBundleService();
if (stringService) {
- stringService->CreateBundle(nsContentUtils::SpoofLocaleEnglish()
- ? NSMEDIADOCUMENT_PROPERTIES_URI_en_US
- : NSMEDIADOCUMENT_PROPERTIES_URI,
+ stringService->CreateBundle(NSMEDIADOCUMENT_PROPERTIES_URI,
getter_AddRefs(mStringBundle));
}
diff --git a/dom/html/MediaDocument.h b/dom/html/MediaDocument.h
index 37e005c7fffa..e11fd2ec8551 100644
--- a/dom/html/MediaDocument.h
+++ b/dom/html/MediaDocument.h
@@ -16,9 +16,6 @@
#define NSMEDIADOCUMENT_PROPERTIES_URI \
"chrome://global/locale/layout/MediaDocument.properties"
-#define NSMEDIADOCUMENT_PROPERTIES_URI_en_US \
- "resource://gre/res/locale/layout/MediaDocument.properties"
-
namespace mozilla {
namespace dom {
diff --git a/dom/html/input/CheckableInputTypes.cpp b/dom/html/input/CheckableInputTypes.cpp
index f0306b69cbd0..f55000c766ea 100644
--- a/dom/html/input/CheckableInputTypes.cpp
+++ b/dom/html/input/CheckableInputTypes.cpp
@@ -23,7 +23,7 @@ bool CheckboxInputType::IsValueMissing() const {
}
nsresult CheckboxInputType::GetValueMissingMessage(nsAString& aMessage) {
- return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF,
+ return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationCheckboxMissing",
aMessage);
}
@@ -32,5 +32,5 @@ nsresult CheckboxInputType::GetValueMissingMessage(nsAString& aMessage) {
nsresult RadioInputType::GetValueMissingMessage(nsAString& aMessage) {
return nsContentUtils::GetLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationRadioMissing", aMessage);
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationRadioMissing", aMessage);
}
diff --git a/dom/html/input/DateTimeInputTypes.cpp b/dom/html/input/DateTimeInputTypes.cpp
index 0efbe9a9121a..11dfc9e541b9 100644
--- a/dom/html/input/DateTimeInputTypes.cpp
+++ b/dom/html/input/DateTimeInputTypes.cpp
@@ -138,7 +138,7 @@ nsresult DateTimeInputTypeBase::GetRangeOverflowMessage(nsAString& aMessage) {
const char16_t* params[] = {maxStr.get()};
return nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationDateTimeRangeOverflow",
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationDateTimeRangeOverflow",
params, aMessage);
}
@@ -148,7 +148,7 @@ nsresult DateTimeInputTypeBase::GetRangeUnderflowMessage(nsAString& aMessage) {
const char16_t* params[] = {minStr.get()};
return nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationDateTimeRangeUnderflow",
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationDateTimeRangeUnderflow",
params, aMessage);
}
@@ -194,7 +194,7 @@ nsresult DateInputType::GetBadInputMessage(nsAString& aMessage) {
}
return nsContentUtils::GetLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationInvalidDate", aMessage);
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationInvalidDate", aMessage);
}
bool DateInputType::ConvertStringToNumber(
diff --git a/dom/html/input/FileInputType.cpp b/dom/html/input/FileInputType.cpp
index 82a4c2de8659..2536a875b2ca 100644
--- a/dom/html/input/FileInputType.cpp
+++ b/dom/html/input/FileInputType.cpp
@@ -22,5 +22,5 @@ bool FileInputType::IsValueMissing() const {
nsresult FileInputType::GetValueMissingMessage(nsAString& aMessage) {
return nsContentUtils::GetLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationFileMissing", aMessage);
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationFileMissing", aMessage);
}
diff --git a/dom/html/input/InputType.cpp b/dom/html/input/InputType.cpp
index f7a28f4c1a3a..210daeafad14 100644
--- a/dom/html/input/InputType.cpp
+++ b/dom/html/input/InputType.cpp
@@ -167,7 +167,7 @@ nsresult InputType::GetValidationMessage(
const char16_t* params[] = {strMaxLength.get(), strTextLength.get()};
rv = nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationTextTooLong", params,
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationTextTooLong", params,
message);
aValidationMessage = message;
break;
@@ -185,7 +185,7 @@ nsresult InputType::GetValidationMessage(
const char16_t* params[] = {strMinLength.get(), strTextLength.get()};
rv = nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationTextTooShort", params,
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationTextTooShort", params,
message);
aValidationMessage = message;
@@ -216,7 +216,7 @@ nsresult InputType::GetValidationMessage(
nsAutoString title;
mInputElement->GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
if (title.IsEmpty()) {
- rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF,
+ rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationPatternMismatch",
message);
} else {
@@ -227,7 +227,7 @@ nsresult InputType::GetValidationMessage(
}
const char16_t* params[] = {title.get()};
rv = nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF,
+ nsContentUtils::eDOM_PROPERTIES,
"FormValidationPatternMismatchWithTitle", params, message);
}
aValidationMessage = message;
@@ -279,12 +279,12 @@ nsresult InputType::GetValidationMessage(
if (valueLowStr.Equals(valueHighStr)) {
const char16_t* params[] = {valueLowStr.get()};
rv = nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF,
+ nsContentUtils::eDOM_PROPERTIES,
"FormValidationStepMismatchOneValue", params, message);
} else {
const char16_t* params[] = {valueLowStr.get(), valueHighStr.get()};
rv = nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationStepMismatch",
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationStepMismatch",
params, message);
}
} else {
@@ -293,7 +293,7 @@ nsresult InputType::GetValidationMessage(
const char16_t* params[] = {valueLowStr.get()};
rv = nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF,
+ nsContentUtils::eDOM_PROPERTIES,
"FormValidationStepMismatchOneValue", params, message);
}
@@ -319,7 +319,7 @@ nsresult InputType::GetValidationMessage(
nsresult InputType::GetValueMissingMessage(nsAString& aMessage) {
return nsContentUtils::GetLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationValueMissing", aMessage);
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationValueMissing", aMessage);
}
nsresult InputType::GetTypeMismatchMessage(nsAString& aMessage) {
diff --git a/dom/html/input/NumericInputTypes.cpp b/dom/html/input/NumericInputTypes.cpp
index ab0f6f36eb95..6332e028c17e 100644
--- a/dom/html/input/NumericInputTypes.cpp
+++ b/dom/html/input/NumericInputTypes.cpp
@@ -73,7 +73,7 @@ nsresult NumericInputTypeBase::GetRangeOverflowMessage(nsAString& aMessage) {
const char16_t* params[] = {maxStr.get()};
return nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationNumberRangeOverflow",
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationNumberRangeOverflow",
params, aMessage);
}
@@ -90,7 +90,7 @@ nsresult NumericInputTypeBase::GetRangeUnderflowMessage(nsAString& aMessage) {
const char16_t* params[] = {minStr.get()};
return nsContentUtils::FormatLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationNumberRangeUnderflow",
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationNumberRangeUnderflow",
params, aMessage);
}
@@ -150,13 +150,13 @@ bool NumberInputType::HasBadInput() const {
}
nsresult NumberInputType::GetValueMissingMessage(nsAString& aMessage) {
- return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF,
+ return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationBadInputNumber",
aMessage);
}
nsresult NumberInputType::GetBadInputMessage(nsAString& aMessage) {
- return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF,
+ return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationBadInputNumber",
aMessage);
}
diff --git a/dom/html/input/SingleLineTextInputTypes.cpp b/dom/html/input/SingleLineTextInputTypes.cpp
index c879276c86da..15cbe65a1941 100644
--- a/dom/html/input/SingleLineTextInputTypes.cpp
+++ b/dom/html/input/SingleLineTextInputTypes.cpp
@@ -117,7 +117,7 @@ bool URLInputType::HasTypeMismatch() const {
nsresult URLInputType::GetTypeMismatchMessage(nsAString& aMessage) {
return nsContentUtils::GetLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationInvalidURL", aMessage);
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationInvalidURL", aMessage);
}
/* input type=email */
@@ -155,12 +155,12 @@ bool EmailInputType::HasBadInput() const {
nsresult EmailInputType::GetTypeMismatchMessage(nsAString& aMessage) {
return nsContentUtils::GetLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationInvalidEmail", aMessage);
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationInvalidEmail", aMessage);
}
nsresult EmailInputType::GetBadInputMessage(nsAString& aMessage) {
return nsContentUtils::GetLocalizedString(
- nsContentUtils::eDOM_PROPERTIES_MAYBESPOOF, "FormValidationInvalidEmail", aMessage);
+ nsContentUtils::eDOM_PROPERTIES, "FormValidationInvalidEmail", aMessage);
}
/* static */
diff --git a/dom/locales/moz.build b/dom/locales/moz.build
index 51f4b88ccd47..b2bcd271de7c 100644
--- a/dom/locales/moz.build
+++ b/dom/locales/moz.build
@@ -62,10 +62,4 @@ JAR_MANIFESTS += ['jar.mn']
RESOURCE_FILES.locale.layout += [
'en-US/chrome/layout/HtmlForm.properties',
- 'en-US/chrome/layout/MediaDocument.properties',
- 'en-US/chrome/layout/xmlparser.properties',
-]
-
-RESOURCE_FILES.locale.dom += [
- 'en-US/chrome/dom/dom.properties',
]
diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in
index 33e0175a624e..2002a894fc51 100644
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -203,9 +203,6 @@
@BINPATH@/res/dtd/*
@BINPATH@/res/language.properties
@BINPATH@/res/locale/layout/HtmlForm.properties
- at BINPATH@/res/locale/layout/MediaDocument.properties
- at BINPATH@/res/locale/layout/xmlparser.properties
- at BINPATH@/res/locale/dom/dom.properties
#ifndef MOZ_ANDROID_EXCLUDE_FONTS
@BINPATH@/res/fonts/*
diff --git a/parser/htmlparser/nsParserMsgUtils.cpp b/parser/htmlparser/nsParserMsgUtils.cpp
index 47749732839e..3e369893d4f7 100644
--- a/parser/htmlparser/nsParserMsgUtils.cpp
+++ b/parser/htmlparser/nsParserMsgUtils.cpp
@@ -9,7 +9,6 @@
#include "nsParserMsgUtils.h"
#include "nsNetCID.h"
#include "mozilla/Services.h"
-#include "nsContentUtils.h"
static nsresult GetBundle(const char* aPropFileName,
nsIStringBundle** aBundle) {
@@ -22,11 +21,6 @@ static nsresult GetBundle(const char* aPropFileName,
mozilla::services::GetStringBundleService();
if (!stringService) return NS_ERROR_FAILURE;
- if (nsContentUtils::SpoofLocaleEnglish() &&
- strcmp(aPropFileName, XMLPARSER_PROPERTIES) == 0) {
- aPropFileName = XMLPARSER_PROPERTIES_en_US;
- }
-
return stringService->CreateBundle(aPropFileName, aBundle);
}
diff --git a/parser/htmlparser/nsParserMsgUtils.h b/parser/htmlparser/nsParserMsgUtils.h
index 3645610385c1..b4ec4784d65f 100644
--- a/parser/htmlparser/nsParserMsgUtils.h
+++ b/parser/htmlparser/nsParserMsgUtils.h
@@ -11,9 +11,6 @@
#define XMLPARSER_PROPERTIES \
"chrome://global/locale/layout/xmlparser.properties"
-#define XMLPARSER_PROPERTIES_en_US \
- "resource://gre/res/locale/layout/xmlparser.properties"
-
class nsParserMsgUtils {
nsParserMsgUtils(); // Currently this is not meant to be created, use the
// static methods
More information about the tbb-commits
mailing list