Title: [211040] trunk/Source/WebCore
Revision
211040
Author
g...@gnome.org
Date
2017-01-23 10:20:10 -0800 (Mon, 23 Jan 2017)

Log Message

[GTK] asserting on unknown locale for hyphenation is wrong
https://bugs.webkit.org/show_bug.cgi?id=167312

Reviewed by Carlos Garcia Campos.

The fact that we hit the assert on a test called 'hyphenation-unknown-locale' is already
a strong indication we should not have it. In addition to that, Carlos Lopez pointed out
a similar assert was removed from the Mac codepaths when the test was introduced.

* platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::lastHyphenLocation): early return when a locale that is not available is provided
for hyphenation, instead of asserting.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (211039 => 211040)


--- trunk/Source/WebCore/ChangeLog	2017-01-23 17:40:30 UTC (rev 211039)
+++ trunk/Source/WebCore/ChangeLog	2017-01-23 18:20:10 UTC (rev 211040)
@@ -1,3 +1,18 @@
+2017-01-23  Gustavo Noronha Silva  <gustavo.noro...@collabora.co.uk>
+
+        [GTK] asserting on unknown locale for hyphenation is wrong
+        https://bugs.webkit.org/show_bug.cgi?id=167312
+
+        Reviewed by Carlos Garcia Campos.
+
+        The fact that we hit the assert on a test called 'hyphenation-unknown-locale' is already
+        a strong indication we should not have it. In addition to that, Carlos Lopez pointed out
+        a similar assert was removed from the Mac codepaths when the test was introduced.
+
+        * platform/text/hyphen/HyphenationLibHyphen.cpp:
+        (WebCore::lastHyphenLocation): early return when a locale that is not available is provided
+        for hyphenation, instead of asserting.
+
 2017-01-23  Chris Dumez  <cdu...@apple.com>
 
         Unreviewed attempt to fix the iOS build after r211033.

Modified: trunk/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp (211039 => 211040)


--- trunk/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp	2017-01-23 17:40:30 UTC (rev 211039)
+++ trunk/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp	2017-01-23 18:20:10 UTC (rev 211040)
@@ -249,7 +249,11 @@
     char* hyphenArrayData = hyphenArray.data();
 
     String lowercaseLocaleIdentifier = AtomicString(localeIdentifier.string().convertToASCIILowercase());
-    ASSERT(availableLocales().contains(lowercaseLocaleIdentifier));
+
+    // Web content may specify strings for locales which do not exist or that we do not have.
+    if (!availableLocales().contains(lowercaseLocaleIdentifier))
+        return 0;
+
     for (const auto& dictionaryPath : availableLocales().get(lowercaseLocaleIdentifier)) {
         RefPtr<HyphenationDictionary> dictionary = WTF::TinyLRUCachePolicy<AtomicString, RefPtr<HyphenationDictionary>>::cache().get(AtomicString(dictionaryPath));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to