Title: [290981] trunk
Revision
290981
Author
[email protected]
Date
2022-03-08 01:09:16 -0800 (Tue, 08 Mar 2022)

Log Message

Remove invalid ASSERT in LocaleIDBuilder::overrideLanguageScriptRegion().
https://bugs.webkit.org/show_bug.cgi?id=237573
<rdar://problem/83326232>

Reviewed by Yusuke Suzuki.

JSTests:

* stress/handle-empty-localeID-in-localeIDBufferForLanguageTagWithNullTerminator.js: Added.

Source/_javascript_Core:

The ASSERT(length) in LocaleIDBuilder::overrideLanguageScriptRegion() is simply
incorrect.  The length can be 0 if uloc_forLanguageTag returns a 0 length in
localeIDBufferForLanguageTagWithNullTerminator().  LocaleIDBuilder::overrideLanguageScriptRegion()
already handles this scenario correctly.  We just need to remove this incorrect ASSERT.

Also verified that we're producing the same result on the attached test case as
Chrome and Firefox produces.

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

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (290980 => 290981)


--- trunk/JSTests/ChangeLog	2022-03-08 08:55:33 UTC (rev 290980)
+++ trunk/JSTests/ChangeLog	2022-03-08 09:09:16 UTC (rev 290981)
@@ -1,3 +1,13 @@
+2022-03-08  Mark Lam  <[email protected]>
+
+        Remove invalid ASSERT in LocaleIDBuilder::overrideLanguageScriptRegion().
+        https://bugs.webkit.org/show_bug.cgi?id=237573
+        <rdar://problem/83326232>
+
+        Reviewed by Yusuke Suzuki.
+
+        * stress/handle-empty-localeID-in-localeIDBufferForLanguageTagWithNullTerminator.js: Added.
+
 2022-03-03  Tom Tartarin  <[email protected]>
 
         [JSC] Update wasm branch hinting

Added: trunk/JSTests/stress/handle-empty-localeID-in-localeIDBufferForLanguageTagWithNullTerminator.js (0 => 290981)


--- trunk/JSTests/stress/handle-empty-localeID-in-localeIDBufferForLanguageTagWithNullTerminator.js	                        (rev 0)
+++ trunk/JSTests/stress/handle-empty-localeID-in-localeIDBufferForLanguageTagWithNullTerminator.js	2022-03-08 09:09:16 UTC (rev 290981)
@@ -0,0 +1,3 @@
+var result = new Intl.Locale('und', { language: 'ru' }).toString();
+if (result != "ru")
+    throw "FAILED";

Modified: trunk/Source/_javascript_Core/ChangeLog (290980 => 290981)


--- trunk/Source/_javascript_Core/ChangeLog	2022-03-08 08:55:33 UTC (rev 290980)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-03-08 09:09:16 UTC (rev 290981)
@@ -1,3 +1,22 @@
+2022-03-08  Mark Lam  <[email protected]>
+
+        Remove invalid ASSERT in LocaleIDBuilder::overrideLanguageScriptRegion().
+        https://bugs.webkit.org/show_bug.cgi?id=237573
+        <rdar://problem/83326232>
+
+        Reviewed by Yusuke Suzuki.
+
+        The ASSERT(length) in LocaleIDBuilder::overrideLanguageScriptRegion() is simply
+        incorrect.  The length can be 0 if uloc_forLanguageTag returns a 0 length in
+        localeIDBufferForLanguageTagWithNullTerminator().  LocaleIDBuilder::overrideLanguageScriptRegion()
+        already handles this scenario correctly.  We just need to remove this incorrect ASSERT.
+
+        Also verified that we're producing the same result on the attached test case as
+        Chrome and Firefox produces.
+
+        * runtime/IntlObject.cpp:
+        (JSC::localeIDBufferForLanguageTagWithNullTerminator):
+
 2022-03-07  Elliott Williams  <[email protected]>
 
         [XCBuild] Emit a discovered dependency file from offlineasm

Modified: trunk/Source/_javascript_Core/runtime/IntlLocale.cpp (290980 => 290981)


--- trunk/Source/_javascript_Core/runtime/IntlLocale.cpp	2022-03-08 08:55:33 UTC (rev 290980)
+++ trunk/Source/_javascript_Core/runtime/IntlLocale.cpp	2022-03-08 09:09:16 UTC (rev 290981)
@@ -117,7 +117,6 @@
 void LocaleIDBuilder::overrideLanguageScriptRegion(StringView language, StringView script, StringView region)
 {
     unsigned length = strlen(m_buffer.data());
-    ASSERT(length);
 
     StringView localeIDView { m_buffer.data(), length };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to