Title: [278697] trunk/Source/_javascript_Core
Revision
278697
Author
[email protected]
Date
2021-06-10 01:06:59 -0700 (Thu, 10 Jun 2021)

Log Message

[JSC] Ignore Intl.NumberFormat feature options when linked-ICU is old
https://bugs.webkit.org/show_bug.cgi?id=226861
rdar://77393100

Reviewed by Ross Kirsling.

Let's just ignore the option when Intl.NumberFormat features cannot be implemented since the linked ICU is old.
There is no way not to expose these features since Intl.NumberFormat's these changes are additional ones and Intl.NumberFormat existed before.

* runtime/IntlNumberFormat.cpp:
(JSC::IntlNumberFormat::initializeNumberFormat):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (278696 => 278697)


--- trunk/Source/_javascript_Core/ChangeLog	2021-06-10 06:26:12 UTC (rev 278696)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-06-10 08:06:59 UTC (rev 278697)
@@ -1,3 +1,17 @@
+2021-06-10  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Ignore Intl.NumberFormat feature options when linked-ICU is old
+        https://bugs.webkit.org/show_bug.cgi?id=226861
+        rdar://77393100
+
+        Reviewed by Ross Kirsling.
+
+        Let's just ignore the option when Intl.NumberFormat features cannot be implemented since the linked ICU is old.
+        There is no way not to expose these features since Intl.NumberFormat's these changes are additional ones and Intl.NumberFormat existed before.
+
+        * runtime/IntlNumberFormat.cpp:
+        (JSC::IntlNumberFormat::initializeNumberFormat):
+
 2021-06-09  Ross Kirsling  <[email protected]>
 
         [JSC] Rename *ByIdVariant to *ByVariant and *ByKind::Normal to *ByKind::ById

Modified: trunk/Source/_javascript_Core/runtime/IntlNumberFormat.cpp (278696 => 278697)


--- trunk/Source/_javascript_Core/runtime/IntlNumberFormat.cpp	2021-06-10 06:26:12 UTC (rev 278696)
+++ trunk/Source/_javascript_Core/runtime/IntlNumberFormat.cpp	2021-06-10 08:06:59 UTC (rev 278697)
@@ -545,8 +545,8 @@
             style = UNUM_CURRENCY;
             break;
         case CurrencyDisplay::NarrowSymbol:
-            throwTypeError(globalObject, scope, "Failed to initialize NumberFormat since used feature is not supported in the linked ICU version"_s);
-            return;
+            style = UNUM_CURRENCY; // Use the same option to "symbol" since linked-ICU does not support it.
+            break;
         case CurrencyDisplay::Name:
             style = UNUM_CURRENCY_PLURAL;
             break;
@@ -555,13 +555,13 @@
         case CurrencySign::Standard:
             break;
         case CurrencySign::Accounting:
-            throwTypeError(globalObject, scope, "Failed to initialize NumberFormat since used feature is not supported in the linked ICU version"_s);
-            return;
+            // Ignore this case since linked ICU does not support it.
+            break;
         }
         break;
     case Style::Unit:
-        throwTypeError(globalObject, scope, "Failed to initialize NumberFormat since used feature is not supported in the linked ICU version"_s);
-        return;
+        // Ignore this case since linked ICU does not support it.
+        break;
     }
 
     switch (m_notation) {
@@ -570,8 +570,8 @@
     case IntlNotation::Scientific:
     case IntlNotation::Engineering:
     case IntlNotation::Compact:
-        throwTypeError(globalObject, scope, "Failed to initialize NumberFormat since used feature is not supported in the linked ICU version"_s);
-        return;
+        // Ignore this case since linked ICU does not support it.
+        break;
     }
 
     switch (m_signDisplay) {
@@ -580,8 +580,8 @@
     case SignDisplay::Never:
     case SignDisplay::Always:
     case SignDisplay::ExceptZero:
-        throwTypeError(globalObject, scope, "Failed to initialize NumberFormat since used feature is not supported in the linked ICU version"_s);
-        return;
+        // Ignore this case since linked ICU does not support it.
+        break;
     }
 
     UErrorCode status = U_ZERO_ERROR;
@@ -611,8 +611,8 @@
         unum_setAttribute(m_numberFormat.get(), UNUM_MAX_SIGNIFICANT_DIGITS, m_maximumSignificantDigits);
         break;
     case IntlRoundingType::CompactRounding:
-        throwTypeError(globalObject, scope, "Failed to initialize NumberFormat since used feature is not supported in the linked ICU version"_s);
-        return;
+        // Ignore this case since linked ICU does not support it.
+        break;
     }
     unum_setAttribute(m_numberFormat.get(), UNUM_GROUPING_USED, m_useGrouping);
     unum_setAttribute(m_numberFormat.get(), UNUM_ROUNDING_MODE, UNUM_ROUND_HALFUP);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to