⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 263837 in webkit


Ignore:
Timestamp:
Jul 2, 2020, 1:47:57 AM (6 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Configure option-offered numberingSystem in Intl.NumberFormat through locale
https://bugs.webkit.org/show_bug.cgi?id=213872

Reviewed by Ross Kirsling.

JSTests:

  • stress/intl-numberformat-nu.js: Added.

(shouldBe):

  • test262/expectations.yaml:

Source/JavaScriptCore:

We need to pass numberingSystem option to ICU through locale when constructing UNumberFormat.
We are passing it when we get "en-US-u-nu-hanidec" locale, but we are not passing it when
we are getting new Intl.NumberFormat("en-US", { numberingSystem: "hanidec" }).

  • runtime/IntlNumberFormat.cpp:

(JSC::IntlNumberFormat::initializeNumberFormat):

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r263833 r263837  
     12020-07-02  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Configure option-offered numberingSystem in Intl.NumberFormat through locale
     4        https://bugs.webkit.org/show_bug.cgi?id=213872
     5
     6        Reviewed by Ross Kirsling.
     7
     8        * stress/intl-numberformat-nu.js: Added.
     9        (shouldBe):
     10        * test262/expectations.yaml:
     11
    1122020-07-01  Yusuke Suzuki  <ysuzuki@apple.com>
    213
  • trunk/JSTests/test262/expectations.yaml

    r263833 r263837  
    17021702  default: 'Test262Error: "und".minimize() should be "en" Expected SameValue(«en-u-va-posix», «en») to be true'
    17031703  strict mode: 'Test262Error: "und".minimize() should be "en" Expected SameValue(«en-u-va-posix», «en») to be true'
    1704 test/intl402/NumberFormat/prototype/format/numbering-systems.js:
    1705   default: 'Test262Error: numberingSystem: adlm, digit: 0 Expected SameValue(«0», «𞥐») to be true'
    1706   strict mode: 'Test262Error: numberingSystem: adlm, digit: 0 Expected SameValue(«0», «𞥐») to be true'
    17071704test/intl402/RelativeTimeFormat/constructor/constructor/locales-valid.js:
    17081705  default: 'Test262Error: Grandfathered Expected a RangeError to be thrown but no exception was thrown at all'
  • trunk/Source/JavaScriptCore/ChangeLog

    r263833 r263837  
     12020-07-02  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Configure option-offered numberingSystem in Intl.NumberFormat through locale
     4        https://bugs.webkit.org/show_bug.cgi?id=213872
     5
     6        Reviewed by Ross Kirsling.
     7
     8        We need to pass numberingSystem option to ICU through locale when constructing UNumberFormat.
     9        We are passing it when we get "en-US-u-nu-hanidec" locale, but we are not passing it when
     10        we are getting `new Intl.NumberFormat("en-US", { numberingSystem: "hanidec" })`.
     11
     12        * runtime/IntlNumberFormat.cpp:
     13        (JSC::IntlNumberFormat::initializeNumberFormat):
     14
    1152020-07-01  Yusuke Suzuki  <ysuzuki@apple.com>
    216
  • trunk/Source/JavaScriptCore/runtime/IntlNumberFormat.cpp

    r261755 r263837  
    4343namespace IntlNumberFormatInternal {
    4444constexpr const char* relevantExtensionKeys[1] = { "nu" };
     45constexpr bool verbose = false;
    4546}
    4647
     
    311312    }
    312313
     314    CString dataLocaleWithExtensions = makeString(result.get("dataLocale"_s), "-u-nu-", m_numberingSystem).utf8();
     315    dataLogLnIf(IntlNumberFormatInternal::verbose, "dataLocaleWithExtensions:(", dataLocaleWithExtensions , ")");
     316
    313317    UErrorCode status = U_ZERO_ERROR;
    314     m_numberFormat = std::unique_ptr<UNumberFormat, UNumberFormatDeleter>(unum_open(style, nullptr, 0, m_locale.utf8().data(), nullptr, &status));
     318    m_numberFormat = std::unique_ptr<UNumberFormat, UNumberFormatDeleter>(unum_open(style, nullptr, 0, dataLocaleWithExtensions.data(), nullptr, &status));
    315319    if (U_FAILURE(status)) {
    316320        throwTypeError(globalObject, scope, "failed to initialize NumberFormat"_s);
Note: See TracChangeset for help on using the changeset viewer.