[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-115.7.0esr-13.5-1] Bug 42374: Check for spoof English in number conversions



Title: GitLab

Pier Angelo Vendrame pushed to branch mullvad-browser-115.7.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser

Commits:

  • 839022b4
    by Pier Angelo Vendrame at 2024-01-18T14:20:49+01:00
    Bug 42374: Check for spoof English in number conversions
    
    Some of the code that converts numbers to strings for inputs uses ICU
    functions to localize numbers, but it does not check for spoof English.
    
    Also, not all functions where consistent in the conversion, so this
    commit addresses also this.
    

2 changed files:

Changes:

  • dom/html/input/NumericInputTypes.cpp
    ... ... @@ -52,11 +52,7 @@ nsresult NumericInputTypeBase::GetRangeOverflowMessage(nsAString& aMessage) {
    52 52
       MOZ_ASSERT(!maximum.isNaN());
    
    53 53
     
    
    54 54
       nsAutoString maxStr;
    
    55
    -  char buf[32];
    
    56
    -  DebugOnly<bool> ok = maximum.toString(buf, ArrayLength(buf));
    
    57
    -  maxStr.AssignASCII(buf);
    
    58
    -  MOZ_ASSERT(ok, "buf not big enough");
    
    59
    -
    
    55
    +  ConvertNumberToString(maximum, maxStr);
    
    60 56
       return nsContentUtils::FormatMaybeLocalizedString(
    
    61 57
           aMessage, nsContentUtils::eDOM_PROPERTIES,
    
    62 58
           "FormValidationNumberRangeOverflow", mInputElement->OwnerDoc(), maxStr);
    
    ... ... @@ -67,11 +63,7 @@ nsresult NumericInputTypeBase::GetRangeUnderflowMessage(nsAString& aMessage) {
    67 63
       MOZ_ASSERT(!minimum.isNaN());
    
    68 64
     
    
    69 65
       nsAutoString minStr;
    
    70
    -  char buf[32];
    
    71
    -  DebugOnly<bool> ok = minimum.toString(buf, ArrayLength(buf));
    
    72
    -  minStr.AssignASCII(buf);
    
    73
    -  MOZ_ASSERT(ok, "buf not big enough");
    
    74
    -
    
    66
    +  ConvertNumberToString(minimum, minStr);
    
    75 67
       return nsContentUtils::FormatMaybeLocalizedString(
    
    76 68
           aMessage, nsContentUtils::eDOM_PROPERTIES,
    
    77 69
           "FormValidationNumberRangeUnderflow", mInputElement->OwnerDoc(), minStr);
    

  • intl/unicharutil/util/ICUUtils.cpp
    ... ... @@ -49,6 +49,13 @@ void ICUUtils::LanguageTagIterForContent::GetNext(nsACString& aBCP47LangTag) {
    49 49
         mCurrentFallbackIndex = 2;
    
    50 50
         // Else take the app's locale:
    
    51 51
     
    
    52
    +    const bool spoofLocale = nsContentUtils::SpoofLocaleEnglish() &&
    
    53
    +                             !mContent->OwnerDoc()->AllowsL10n();
    
    54
    +    if (spoofLocale) {
    
    55
    +      aBCP47LangTag.AssignLiteral("en-US");
    
    56
    +      return;
    
    57
    +    }
    
    58
    +
    
    52 59
         nsAutoCString appLocale;
    
    53 60
         LocaleService::GetInstance()->GetAppLocaleAsBCP47(aBCP47LangTag);
    
    54 61
         return;
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits