Title: [260151] trunk
Revision
260151
Author
ross.kirsl...@sony.com
Date
2020-04-15 14:18:36 -0700 (Wed, 15 Apr 2020)

Log Message

[ECMA-402] Extension values should default to true, canonicalize without "-true"
https://bugs.webkit.org/show_bug.cgi?id=210457

Reviewed by Yusuke Suzuki.

JSTests:

* stress/intl-collator.js:
* stress/intl-datetimeformat.js:
* stress/intl-numberformat.js:
* stress/intl-object.js:
* stress/intl-pluralrules.js:
Fix tests.

* test262/expectations.yaml:
Mark two test cases as passing.

Source/_javascript_Core:

This patch implements two simple intertwining updates to ECMA-402:

  - Valueless extension keys should not be dropped when resolving locale
    https://tc39.es/ecma402/#sec-resolvelocale (9.h.4.b)

  - Following UTS 35, "-true" should not appear in canonicalized locale ids
    https://tc39.es/ecma402/#sec-canonicalizeunicodelocaleid
    https://unicode.org/reports/tr35/#Canonical_Unicode_Locale_Identifiers
    ('Any type or tfield value "true" is removed.')

* runtime/IntlObject.cpp:
(JSC::canonicalLangTag):
(JSC::resolveLocale):

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (260150 => 260151)


--- trunk/JSTests/ChangeLog	2020-04-15 21:07:14 UTC (rev 260150)
+++ trunk/JSTests/ChangeLog	2020-04-15 21:18:36 UTC (rev 260151)
@@ -1,3 +1,20 @@
+2020-04-15  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        [ECMA-402] Extension values should default to true, canonicalize without "-true"
+        https://bugs.webkit.org/show_bug.cgi?id=210457
+
+        Reviewed by Yusuke Suzuki.
+
+        * stress/intl-collator.js:
+        * stress/intl-datetimeformat.js:
+        * stress/intl-numberformat.js:
+        * stress/intl-object.js:
+        * stress/intl-pluralrules.js:
+        Fix tests.
+
+        * test262/expectations.yaml:
+        Mark two test cases as passing.
+
 2020-04-15  Justin Michaud  <jus...@justinmichaud.com>
 
         stress/delete-property-dfg-inline.js.ftl-no-cjit-small-pool consistently timing out on debug JSC bot

Modified: trunk/JSTests/stress/intl-collator.js (260150 => 260151)


--- trunk/JSTests/stress/intl-collator.js	2020-04-15 21:07:14 UTC (rev 260150)
+++ trunk/JSTests/stress/intl-collator.js	2020-04-15 21:18:36 UTC (rev 260151)
@@ -81,8 +81,8 @@
 shouldBe(testCollator(Intl.Collator('de-u-co-phonebk'), [{locale: 'de-u-co-phonebk', collation: 'phonebk'}, {locale: 'de'}]), true);
 
 // The 'kn' key is processed correctly.
-shouldBe(testCollator(Intl.Collator('en-u-kn'), [{locale: 'en', numeric: true}]), true);
-shouldBe(testCollator(Intl.Collator('en-u-kn-true'), [{locale: 'en-u-kn-true', numeric: true}]), true);
+shouldBe(testCollator(Intl.Collator('en-u-kn'), [{locale: 'en-u-kn', numeric: true}]), true);
+shouldBe(testCollator(Intl.Collator('en-u-kn-true'), [{locale: 'en-u-kn', numeric: true}]), true);
 shouldBe(testCollator(Intl.Collator('en-u-kn-false'), [{locale: 'en-u-kn-false', numeric: false}]), true);
 shouldBe(testCollator(Intl.Collator('en-u-kn-abcd'), [{locale: 'en'}]), true);
 
@@ -94,12 +94,12 @@
 shouldBe(testCollator(Intl.Collator('en-u-kf-true'), [{locale: 'en'}]), true);
 
 // Ignores irrelevant extension keys.
-shouldBe(testCollator(Intl.Collator('en-u-aa-aaaa-kn-true-bb-bbbb-co-eor-cc-cccc-y-yyd'), [{locale: 'en-u-co-eor-kn-true', collation: 'eor', numeric: true}, {locale: 'en-u-kn-true', numeric: true}]), true);
+shouldBe(testCollator(Intl.Collator('en-u-aa-aaaa-kn-true-bb-bbbb-co-eor-cc-cccc-y-yyd'), [{locale: 'en-u-co-eor-kn', collation: 'eor', numeric: true}, {locale: 'en-u-kn', numeric: true}]), true);
 
 // Ignores other extensions.
-shouldBe(testCollator(Intl.Collator('en-u-kn-true-a-aa'), [{locale: 'en-u-kn-true', numeric: true}]), true);
-shouldBe(testCollator(Intl.Collator('en-a-aa-u-kn-true'), [{locale: 'en-u-kn-true', numeric: true}]), true);
-shouldBe(testCollator(Intl.Collator('en-a-aa-u-kn-true-b-bb'), [{locale: 'en-u-kn-true', numeric: true}]), true);
+shouldBe(testCollator(Intl.Collator('en-u-kn-true-a-aa'), [{locale: 'en-u-kn', numeric: true}]), true);
+shouldBe(testCollator(Intl.Collator('en-a-aa-u-kn-true'), [{locale: 'en-u-kn', numeric: true}]), true);
+shouldBe(testCollator(Intl.Collator('en-a-aa-u-kn-true-b-bb'), [{locale: 'en-u-kn', numeric: true}]), true);
 
 // The option usage is processed correctly.
 shouldBe(testCollator(Intl.Collator('en', {usage: 'sort'}), [{locale: 'en', usage: 'sort'}]), true);
@@ -146,7 +146,7 @@
 // Options override the language tag.
 shouldBe(testCollator(Intl.Collator('en-u-kn-true', {numeric: false}), [{locale: 'en', numeric: false}]), true);
 shouldBe(testCollator(Intl.Collator('en-u-kn-false', {numeric: true}), [{locale: 'en', numeric: true}]), true);
-shouldBe(testCollator(Intl.Collator('en-u-kn-true', {numeric: true}), [{locale: 'en-u-kn-true', numeric: true}]), true);
+shouldBe(testCollator(Intl.Collator('en-u-kn-true', {numeric: true}), [{locale: 'en-u-kn', numeric: true}]), true);
 shouldBe(testCollator(Intl.Collator('en-u-kn-false', {numeric: false}), [{locale: 'en-u-kn-false', numeric: false}]), true);
 
 // Options and extension keys are processed correctly.
@@ -184,7 +184,7 @@
 // Deduplicates tags.
 shouldBe(JSON.stringify(Intl.Collator.supportedLocalesOf(['en', 'pt', 'en', 'es'])), '["en","pt","es"]');
 // Canonicalizes tags.
-shouldBe(JSON.stringify(Intl.Collator.supportedLocalesOf('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED')), '["en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-true-x-reserved"]');
+shouldBe(JSON.stringify(Intl.Collator.supportedLocalesOf('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED')), '["en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-x-reserved"]');
 // Replaces outdated tags.
 shouldBe(JSON.stringify(Intl.Collator.supportedLocalesOf('no-bok')), '["nb"]');
 // Doesn't throw, but ignores private tags.

Modified: trunk/JSTests/stress/intl-datetimeformat.js (260150 => 260151)


--- trunk/JSTests/stress/intl-datetimeformat.js	2020-04-15 21:07:14 UTC (rev 260150)
+++ trunk/JSTests/stress/intl-datetimeformat.js	2020-04-15 21:18:36 UTC (rev 260151)
@@ -71,7 +71,7 @@
 // Deduplicates tags.
 shouldBe(JSON.stringify(Intl.DateTimeFormat.supportedLocalesOf([ 'en', 'pt', 'en', 'es' ])), '["en","pt","es"]');
 // Canonicalizes tags.
-shouldBe(JSON.stringify(Intl.DateTimeFormat.supportedLocalesOf('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED')), '["en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-true-x-reserved"]');
+shouldBe(JSON.stringify(Intl.DateTimeFormat.supportedLocalesOf('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED')), '["en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-x-reserved"]');
 // Replaces outdated tags.
 shouldBe(JSON.stringify(Intl.DateTimeFormat.supportedLocalesOf('no-bok')), '["nb"]');
 // Doesn't throw, but ignores private tags.

Modified: trunk/JSTests/stress/intl-numberformat.js (260150 => 260151)


--- trunk/JSTests/stress/intl-numberformat.js	2020-04-15 21:07:14 UTC (rev 260150)
+++ trunk/JSTests/stress/intl-numberformat.js	2020-04-15 21:18:36 UTC (rev 260151)
@@ -220,7 +220,7 @@
 // Deduplicates tags.
 shouldBe(JSON.stringify(Intl.NumberFormat.supportedLocalesOf([ 'en', 'pt', 'en', 'es' ])), '["en","pt","es"]');
 // Canonicalizes tags.
-shouldBe(JSON.stringify(Intl.NumberFormat.supportedLocalesOf('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED')), '["en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-true-x-reserved"]');
+shouldBe(JSON.stringify(Intl.NumberFormat.supportedLocalesOf('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED')), '["en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-x-reserved"]');
 // Replaces outdated tags.
 shouldBe(JSON.stringify(Intl.NumberFormat.supportedLocalesOf('no-bok')), '["nb"]');
 // Doesn't throw, but ignores private tags.

Modified: trunk/JSTests/stress/intl-object.js (260150 => 260151)


--- trunk/JSTests/stress/intl-object.js	2020-04-15 21:07:14 UTC (rev 260150)
+++ trunk/JSTests/stress/intl-object.js	2020-04-15 21:18:36 UTC (rev 260151)
@@ -68,7 +68,7 @@
 // Deduplicates tags.
 shouldBe(JSON.stringify(Intl.getCanonicalLocales([ 'en', 'pt', 'en', 'es' ])), '["en","pt","es"]');
 // Canonicalizes tags.
-shouldBe(JSON.stringify(Intl.getCanonicalLocales('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED')), '["en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-true-x-reserved"]');
+shouldBe(JSON.stringify(Intl.getCanonicalLocales('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED')), '["en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-x-reserved"]');
 // Replaces outdated tags.
 shouldBe(JSON.stringify(Intl.getCanonicalLocales('no-bok')), '["nb"]');
 // Canonicalizes private tags.

Modified: trunk/JSTests/stress/intl-pluralrules.js (260150 => 260151)


--- trunk/JSTests/stress/intl-pluralrules.js	2020-04-15 21:07:14 UTC (rev 260150)
+++ trunk/JSTests/stress/intl-pluralrules.js	2020-04-15 21:18:36 UTC (rev 260151)
@@ -79,7 +79,7 @@
 // Deduplicates tags.
 shouldBe(JSON.stringify(Intl.PluralRules.supportedLocalesOf([ 'en', 'pt', 'en', 'es' ])), '["en","pt","es"]');
 // Canonicalizes tags.
-shouldBe(JSON.stringify(Intl.PluralRules.supportedLocalesOf('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED')), '["en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-true-x-reserved"]');
+shouldBe(JSON.stringify(Intl.PluralRules.supportedLocalesOf('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED')), '["en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-x-reserved"]');
 // Replaces outdated tags.
 shouldBe(JSON.stringify(Intl.PluralRules.supportedLocalesOf('no-bok')), '["nb"]');
 // Doesn't throw, but ignores private tags.

Modified: trunk/JSTests/test262/expectations.yaml (260150 => 260151)


--- trunk/JSTests/test262/expectations.yaml	2020-04-15 21:07:14 UTC (rev 260150)
+++ trunk/JSTests/test262/expectations.yaml	2020-04-15 21:18:36 UTC (rev 260151)
@@ -1911,9 +1911,6 @@
 test/built-ins/WeakSet/proto-from-ctor-realm.js:
   default: 'Test262Error: Expected SameValue(«[object WeakSet]», «[object WeakSet]») to be true'
   strict mode: 'Test262Error: Expected SameValue(«[object WeakSet]», «[object WeakSet]») to be true'
-test/intl402/Collator/missing-unicode-ext-value-defaults-to-true.js:
-  default: 'Test262Error: "kn" should be returned in locale. Expected SameValue(«false», «true») to be true'
-  strict mode: 'Test262Error: "kn" should be returned in locale. Expected SameValue(«false», «true») to be true'
 test/intl402/Collator/proto-from-ctor-realm.js:
   default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'
   strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'

Modified: trunk/Source/_javascript_Core/ChangeLog (260150 => 260151)


--- trunk/Source/_javascript_Core/ChangeLog	2020-04-15 21:07:14 UTC (rev 260150)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-04-15 21:18:36 UTC (rev 260151)
@@ -1,5 +1,26 @@
 2020-04-15  Ross Kirsling  <ross.kirsl...@sony.com>
 
+        [ECMA-402] Extension values should default to true, canonicalize without "-true"
+        https://bugs.webkit.org/show_bug.cgi?id=210457
+
+        Reviewed by Yusuke Suzuki.
+
+        This patch implements two simple intertwining updates to ECMA-402:
+
+          - Valueless extension keys should not be dropped when resolving locale
+            https://tc39.es/ecma402/#sec-resolvelocale (9.h.4.b)
+
+          - Following UTS 35, "-true" should not appear in canonicalized locale ids
+            https://tc39.es/ecma402/#sec-canonicalizeunicodelocaleid
+            https://unicode.org/reports/tr35/#Canonical_Unicode_Locale_Identifiers
+            ('Any type or tfield value "true" is removed.')
+
+        * runtime/IntlObject.cpp:
+        (JSC::canonicalLangTag):
+        (JSC::resolveLocale):
+
+2020-04-15  Ross Kirsling  <ross.kirsl...@sony.com>
+
         [ECMA-402] Fix Intl.DateTimeFormat patterns and fields in WebKit
         https://bugs.webkit.org/show_bug.cgi?id=209783
 

Modified: trunk/Source/_javascript_Core/runtime/IntlObject.cpp (260150 => 260151)


--- trunk/Source/_javascript_Core/runtime/IntlObject.cpp	2020-04-15 21:07:14 UTC (rev 260150)
+++ trunk/Source/_javascript_Core/runtime/IntlObject.cpp	2020-04-15 21:18:36 UTC (rev 260151)
@@ -534,8 +534,12 @@
 
             ++currentIndex;
             ++numExtParts;
-            extension.append('-');
-            extension.append(extPart.convertToASCIILowercase());
+
+            auto lowercase = extPart.convertToASCIILowercase();
+            if (lowercase != "true"_s) {
+                extension.append('-');
+                extension.append(lowercase);
+            }
         }
 
         // Requires at least one production.
@@ -885,6 +889,7 @@
                     }
                 } else if (keyLocaleData.contains(static_cast<String>("true"_s))) {
                     value = "true"_s;
+                    supportedExtensionAddition = makeString('-', key);
                 }
             }
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to