Title: [282897] trunk
Revision
282897
Author
ysuz...@apple.com
Date
2021-09-22 17:39:19 -0700 (Wed, 22 Sep 2021)

Log Message

[JSC] emoji and eor collations are missing
https://bugs.webkit.org/show_bug.cgi?id=230652

Reviewed by Ross Kirsling.

JSTests:

* stress/intl-enumeration.js:
* test262/expectations.yaml:

Source/_javascript_Core:

Due to ICU's bug, "emoji" and "eor" collations are missing from enumeration.
This patch adds work-around for this.

* runtime/IntlObject.cpp:
(JSC::availableCollations):

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (282896 => 282897)


--- trunk/JSTests/ChangeLog	2021-09-23 00:22:01 UTC (rev 282896)
+++ trunk/JSTests/ChangeLog	2021-09-23 00:39:19 UTC (rev 282897)
@@ -1,5 +1,15 @@
 2021-09-22  Yusuke Suzuki  <ysuz...@apple.com>
 
+        [JSC] emoji and eor collations are missing
+        https://bugs.webkit.org/show_bug.cgi?id=230652
+
+        Reviewed by Ross Kirsling.
+
+        * stress/intl-enumeration.js:
+        * test262/expectations.yaml:
+
+2021-09-22  Yusuke Suzuki  <ysuz...@apple.com>
+
         [JSC] Intl unicode identifier type will reject underscore
         https://bugs.webkit.org/show_bug.cgi?id=230645
 

Modified: trunk/JSTests/stress/intl-enumeration.js (282896 => 282897)


--- trunk/JSTests/stress/intl-enumeration.js	2021-09-23 00:22:01 UTC (rev 282896)
+++ trunk/JSTests/stress/intl-enumeration.js	2021-09-23 00:39:19 UTC (rev 282897)
@@ -19,7 +19,7 @@
 shouldBe(JSON.stringify(calendars), `["buddhist","chinese","coptic","dangi","ethioaa","ethiopic","gregory","hebrew","indian","islamic","islamic-civil","islamic-rgsa","islamic-tbla","islamic-umalqura","iso8601","japanese","persian","roc"]`);
 
 let collations = Intl.supportedValuesOf("collation");
-shouldBe(JSON.stringify(collations), `["big5han","compat","dict","gb2312","phonebk","phonetic","pinyin","reformed","searchjl","stroke","trad","unihan","zhuyin"]`);
+shouldBe(JSON.stringify(collations), `["big5han","compat","dict","emoji","eor","gb2312","phonebk","phonetic","pinyin","reformed","searchjl","stroke","trad","unihan","zhuyin"]`);
 
 let currencies = Intl.supportedValuesOf("currency");
 shouldBe(JSON.stringify(currencies), `["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BRL","BSD","BTN","BWP","BYN","BZD","CAD","CDF","CHF","CLP","CNY","COP","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","
 HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK&q
 uot;,"SGD","SHP","SLL","SOS","SRD","SSP","STN","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VEF","VND","VUV","WST","XAF","XCD","XOF","XPF","YER","ZAR","ZMW"]`);

Modified: trunk/JSTests/test262/expectations.yaml (282896 => 282897)


--- trunk/JSTests/test262/expectations.yaml	2021-09-23 00:22:01 UTC (rev 282896)
+++ trunk/JSTests/test262/expectations.yaml	2021-09-23 00:39:19 UTC (rev 282897)
@@ -849,9 +849,6 @@
 test/intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-subdivision.js:
   default: 'Test262Error: Expected SameValue(«und-NO-u-sd-no23», «und-NO-u-sd-no50») to be true'
   strict mode: 'Test262Error: Expected SameValue(«und-NO-u-sd-no23», «und-NO-u-sd-no50») to be true'
-test/intl402/Intl/supportedValuesOf/collations-accepted-by-Collator.js:
-  default: 'Test262Error: emoji supported but not returned by supportedValuesOf'
-  strict mode: 'Test262Error: emoji supported but not returned by supportedValuesOf'
 test/intl402/Intl/supportedValuesOf/currencies-accepted-by-DisplayNames.js:
   default: 'Test262Error: ADP supported but not returned by supportedValuesOf'
   strict mode: 'Test262Error: ADP supported but not returned by supportedValuesOf'

Modified: trunk/Source/_javascript_Core/ChangeLog (282896 => 282897)


--- trunk/Source/_javascript_Core/ChangeLog	2021-09-23 00:22:01 UTC (rev 282896)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-09-23 00:39:19 UTC (rev 282897)
@@ -1,5 +1,18 @@
 2021-09-22  Yusuke Suzuki  <ysuz...@apple.com>
 
+        [JSC] emoji and eor collations are missing
+        https://bugs.webkit.org/show_bug.cgi?id=230652
+
+        Reviewed by Ross Kirsling.
+
+        Due to ICU's bug, "emoji" and "eor" collations are missing from enumeration.
+        This patch adds work-around for this.
+
+        * runtime/IntlObject.cpp:
+        (JSC::availableCollations):
+
+2021-09-22  Yusuke Suzuki  <ysuz...@apple.com>
+
         [JSC] Intl unicode identifier type will reject underscore
         https://bugs.webkit.org/show_bug.cgi?id=230645
 

Modified: trunk/Source/_javascript_Core/runtime/IntlObject.cpp (282896 => 282897)


--- trunk/Source/_javascript_Core/runtime/IntlObject.cpp	2021-09-23 00:22:01 UTC (rev 282896)
+++ trunk/Source/_javascript_Core/runtime/IntlObject.cpp	2021-09-23 00:39:19 UTC (rev 282897)
@@ -1657,7 +1657,11 @@
     }
 
     Vector<String, 1> elements;
-    elements.reserveInitialCapacity(count);
+    elements.reserveInitialCapacity(count + 2);
+    // ICU ~69 has a bug that does not report "emoji" and "eor" for collation when using ucol_getKeywordValues.
+    // https://github.com/unicode-org/icu/commit/24778dfc9bf67f431509361a173a33a1ab860b5d
+    elements.append("emoji"_s);
+    elements.append("eor"_s);
     for (int32_t index = 0; index < count; ++index) {
         int32_t length = 0;
         const char* pointer = uenum_next(enumeration.get(), &length, &status);
@@ -1680,6 +1684,8 @@
         [](const String& a, const String& b) {
             return WTF::codePointCompare(a, b) < 0;
         });
+    auto end = std::unique(elements.begin(), elements.end());
+    elements.resize(elements.size() - (elements.end() - end));
 
     RELEASE_AND_RETURN(scope, createArrayFromStringVector(globalObject, WTFMove(elements)));
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to