Changeset 263833 in webkit
- Timestamp:
- Jul 1, 2020, 11:00:36 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/intl-collator-co-extension.js (added)
-
JSTests/test262/expectations.yaml (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/runtime/IntlCollator.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r263608 r263833 1 2020-07-01 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Intl.Collator should set usage:"search" option through ICU locale 4 https://bugs.webkit.org/show_bug.cgi?id=213869 5 6 Reviewed by Ross Kirsling. 7 8 * stress/intl-collator-co-extension.js: Added. 9 (shouldBe): 10 (shouldBeArray): 11 (explicitTrueBeforeICU67): 12 * test262/expectations.yaml: 13 1 14 2020-06-26 Yusuke Suzuki <ysuzuki@apple.com> 2 15 -
trunk/JSTests/test262/expectations.yaml
r263608 r263833 1606 1606 default: "Test262Error: \"kn-true\" is returned in locale, but shouldn't be. Expected SameValue(«7», «-1») to be true" 1607 1607 strict mode: "Test262Error: \"kn-true\" is returned in locale, but shouldn't be. Expected SameValue(«7», «-1») to be true" 1608 test/intl402/Collator/usage-de.js:1609 default: 'Test262Error: Expected [Ä, AE] and [AE, Ä] to have the same contents. search'1610 strict mode: 'Test262Error: Expected [Ä, AE] and [AE, Ä] to have the same contents. search'1611 1608 test/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle-default.js: 1612 1609 default: 'Test262Error: Expected SameValue(«h24», «h23») to be true' -
trunk/Source/JavaScriptCore/ChangeLog
r263824 r263833 1 2020-07-01 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Intl.Collator should set usage:"search" option through ICU locale 4 https://bugs.webkit.org/show_bug.cgi?id=213869 5 6 Reviewed by Ross Kirsling. 7 8 Intl.Collator has usage:"search" option, and it affects on collation. However, UCollator does not have an interface to set this collation option, 9 and only way to configure UCollator is setting "-u-co-search" unicode extension to passed locale string. This patch adds "-u-co-search" unicode 10 extension if Usage::Search is specified. 11 12 * runtime/IntlCollator.cpp: 13 (JSC::IntlCollator::initializeCollator): 14 1 15 2020-07-01 Keith Miller <keith_miller@apple.com> 2 16 -
trunk/Source/JavaScriptCore/runtime/IntlCollator.cpp
r261755 r263833 44 44 constexpr size_t caseFirstIndex = 1; 45 45 constexpr size_t numericIndex = 2; 46 constexpr bool verbose = false; 46 47 } 47 48 … … 241 242 m_ignorePunctuation = (ignorePunctuation == TriState::True); 242 243 244 // UCollator does not offer an option to configure "usage" via ucol_setAttribute. So we need to pass this option via locale. 245 CString dataLocaleWithExtensions; 246 switch (m_usage) { 247 case Usage::Sort: 248 dataLocaleWithExtensions = m_locale.utf8(); 249 break; 250 case Usage::Search: 251 // searchLocaleData filters out "co" unicode extension. However, we need to pass "co" to ICU when Usage::Search is specified. 252 // So we need to pass "co" unicode extension through locale. Since the other relevant extensions are handled via ucol_setAttribute, 253 // we can just use dataLocale 254 dataLocaleWithExtensions = makeString(result.get("dataLocale"_s), "-u-co-search").utf8(); 255 break; 256 } 257 dataLogLnIf(IntlCollatorInternal::verbose, "dataLocaleWithExtensions:(", dataLocaleWithExtensions, ")"); 258 243 259 UErrorCode status = U_ZERO_ERROR; 244 m_collator = std::unique_ptr<UCollator, UCollatorDeleter>(ucol_open( m_locale.utf8().data(), &status));260 m_collator = std::unique_ptr<UCollator, UCollatorDeleter>(ucol_open(dataLocaleWithExtensions.data(), &status)); 245 261 if (U_FAILURE(status)) { 246 262 throwTypeError(globalObject, scope, "failed to initialize Collator"_s);
Note:
See TracChangeset
for help on using the changeset viewer.