[tor-commits] [tor-browser/tor-browser-68.1.0esr-9.0-1] Revert "Bug 24056: Use en-US strings in HTML forms"

gk at torproject.org gk at torproject.org
Thu Aug 29 10:58:32 UTC 2019


commit 69bf59ac52f26317e93e2325a8e8c1d797f56c0c
Author: Alex Catarineu <acat at torproject.org>
Date:   Mon Aug 19 13:13:36 2019 +0200

    Revert "Bug 24056: Use en-US strings in HTML forms"
    
    This reverts commit 243a68926e148a2590707ee9b3cb2364e2f42083.
---
 dom/base/nsContentUtils.cpp | 32 +++++++-------------------------
 dom/base/nsContentUtils.h   |  3 ---
 2 files changed, 7 insertions(+), 28 deletions(-)

diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
index a7ff89977a95..ca8ad1d26b26 100644
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -317,8 +317,6 @@ bool nsContentUtils::sBypassCSSOMOriginCheck = false;
 
 nsCString* nsContentUtils::sJSBytecodeMimeType = nullptr;
 
-int32_t nsContentUtils::sSpoofEnglish = 0;
-
 nsContentUtils::UserInteractionObserver*
     nsContentUtils::sUserInteractionObserver = nullptr;
 
@@ -607,8 +605,6 @@ nsresult nsContentUtils::Init() {
   Preferences::AddBoolVarCache(&sAllowXULXBL_for_file,
                                "dom.allow_XUL_XBL_for_file");
 
-  Preferences::AddIntVarCache(&sSpoofEnglish, "privacy.spoof_english", 0);
-
 #ifndef RELEASE_OR_BETA
   sBypassCSSOMOriginCheck = getenv("MOZ_BYPASS_CSSOM_ORIGIN_CHECK");
 #endif
@@ -3511,7 +3507,7 @@ void nsContentUtils::GetEventArgNames(int32_t aNameSpaceID, nsAtom* aEventName,
 
 // Note: The list of content bundles in nsStringBundle.cpp should be updated
 // whenever entries are added or removed from this list.
-static const char* gPropertiesFiles[nsContentUtils::PropertiesFile_COUNT] = {
+static const char gPropertiesFiles[nsContentUtils::PropertiesFile_COUNT][56] = {
     // Must line up with the enum values in |PropertiesFile| enum.
     "chrome://global/locale/css.properties",
     "chrome://global/locale/xbl.properties",
@@ -3526,9 +3522,7 @@ static const char* gPropertiesFiles[nsContentUtils::PropertiesFile_COUNT] = {
     "chrome://global/locale/commonDialogs.properties",
     "chrome://global/locale/mathml/mathml.properties",
     "chrome://global/locale/security/security.properties",
-    "chrome://necko/locale/necko.properties",
-    "resource://gre/chrome/en-US/locale/en-US/global/layout/"
-    "HtmlForm.properties"};
+    "chrome://necko/locale/necko.properties"};
 
 /* static */
 nsresult nsContentUtils::EnsureStringBundle(PropertiesFile aFile) {
@@ -3581,11 +3575,6 @@ void nsContentUtils::AsyncPrecreateStringBundles() {
 nsresult nsContentUtils::GetLocalizedString(PropertiesFile aFile,
                                             const char* aKey,
                                             nsAString& aResult) {
-  // When we spoof English, use en-US default strings in HTML forms.
-  if (aFile == eFORMS_PROPERTIES && sSpoofEnglish == 2) {
-    aFile = eFORMS_PROPERTIES_en_US;
-  }
-
   nsresult rv = EnsureStringBundle(aFile);
   NS_ENSURE_SUCCESS(rv, rv);
   nsIStringBundle* bundle = sStringBundles[aFile];
@@ -3598,11 +3587,6 @@ nsresult nsContentUtils::FormatLocalizedString(PropertiesFile aFile,
                                                const char16_t** aParams,
                                                uint32_t aParamsLength,
                                                nsAString& aResult) {
-  // When we spoof English, use en-US default strings in HTML forms.
-  if (aFile == eFORMS_PROPERTIES && sSpoofEnglish == 2) {
-    aFile = eFORMS_PROPERTIES_en_US;
-  }
-
   nsresult rv = EnsureStringBundle(aFile);
   NS_ENSURE_SUCCESS(rv, rv);
   nsIStringBundle* bundle = sStringBundles[aFile];
@@ -5136,13 +5120,11 @@ nsIWidget* nsContentUtils::GetTopLevelWidget(nsIWidget* aWidget) {
 const nsDependentString nsContentUtils::GetLocalizedEllipsis() {
   static char16_t sBuf[4] = {0, 0, 0, 0};
   if (!sBuf[0]) {
-    if (sSpoofEnglish != 2) {
-      nsAutoString tmp;
-      Preferences::GetLocalizedString("intl.ellipsis", tmp);
-      uint32_t len =
-          std::min(uint32_t(tmp.Length()), uint32_t(ArrayLength(sBuf) - 1));
-      CopyUnicodeTo(tmp, 0, sBuf, len);
-    }
+    nsAutoString tmp;
+    Preferences::GetLocalizedString("intl.ellipsis", tmp);
+    uint32_t len =
+        std::min(uint32_t(tmp.Length()), uint32_t(ArrayLength(sBuf) - 1));
+    CopyUnicodeTo(tmp, 0, sBuf, len);
     if (!sBuf[0]) sBuf[0] = char16_t(0x2026);
   }
   return nsDependentString(sBuf);
diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h
index 4ea35a42f029..de450090e9db 100644
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -1117,7 +1117,6 @@ class nsContentUtils {
     eMATHML_PROPERTIES,
     eSECURITY_PROPERTIES,
     eNECKO_PROPERTIES,
-    eFORMS_PROPERTIES_en_US,
     PropertiesFile_COUNT
   };
   static nsresult ReportToConsole(
@@ -3421,8 +3420,6 @@ class nsContentUtils {
 
   static int32_t sInnerOrOuterWindowCount;
   static uint32_t sInnerOrOuterWindowSerialCounter;
-
-  static int32_t sSpoofEnglish;
 };
 
 /* static */ inline nsContentPolicyType





More information about the tor-commits mailing list