Log Message
Remove TEC decoders that duplicate ICU decoders https://bugs.webkit.org/show_bug.cgi?id=179460
Reviewed by Darin Adler. Source/WebCore: Test: fast/encoding/duplicate-tec-encodings.html * platform/text/TextEncodingRegistry.cpp: (WebCore::checkExistingName): Deleted. (WebCore::addToTextEncodingNameMap): Move the check from checkExistingName here, and make it an ASSERT, since we should now be guaranteed no duplicate encodings. * platform/text/mac/mac-encodings.txt: Remove encodings that duplicate ones we implement with ICU. * platform/text/TextCodecICU.cpp: Add some extra encoding aliases that only TEC knew about. LayoutTests: * fast/encoding/duplicate-tec-encodings-expected.txt: Added. * fast/encoding/duplicate-tec-encodings.html: Added.
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/platform/text/TextCodecICU.cpp
- trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp
- trunk/Source/WebCore/platform/text/mac/mac-encodings.txt
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (224699 => 224700)
--- trunk/LayoutTests/ChangeLog 2017-11-10 19:23:13 UTC (rev 224699)
+++ trunk/LayoutTests/ChangeLog 2017-11-10 19:26:25 UTC (rev 224700)
@@ -1,3 +1,13 @@
+2017-11-10 Maciej Stachowiak <m...@apple.com>
+
+ Remove TEC decoders that duplicate ICU decoders
+ https://bugs.webkit.org/show_bug.cgi?id=179460
+
+ Reviewed by Darin Adler.
+
+ * fast/encoding/duplicate-tec-encodings-expected.txt: Added.
+ * fast/encoding/duplicate-tec-encodings.html: Added.
+
2017-11-10 Colin Bendell <co...@bendell.ca>
Fix race conditions with setBackingScaleFactor, page refresh and preloader
Added: trunk/LayoutTests/fast/encoding/duplicate-tec-encodings-expected.txt (0 => 224700)
--- trunk/LayoutTests/fast/encoding/duplicate-tec-encodings-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/encoding/duplicate-tec-encodings-expected.txt 2017-11-10 19:26:25 UTC (rev 224700)
@@ -0,0 +1,29 @@
+This test verifies that encodings that used to be supported by TEC on macOS are still supported.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+The following encoding names are supported by WebKit cross-platform, but some may be removed at a later time.
+PASS new TextDecoder("iso-8859-10").encoding is "iso-8859-10"
+PASS new TextDecoder("iso8859101992").encoding is "iso-8859-10"
+PASS new TextDecoder("isoir157").encoding is "iso-8859-10"
+PASS new TextDecoder("csisolatin6").encoding is "iso-8859-10"
+PASS new TextDecoder("latin6").encoding is "iso-8859-10"
+PASS new TextDecoder("l6").encoding is "iso-8859-10"
+PASS new TextDecoder("iso-8859-11").encoding is "windows-874"
+PASS new TextDecoder("iso-8859-14").encoding is "iso-8859-14"
+PASS new TextDecoder("isoceltic").encoding is "iso-8859-14"
+PASS new TextDecoder("iso8859141998").encoding is "iso-8859-14"
+PASS new TextDecoder("isoir199").encoding is "iso-8859-14"
+PASS new TextDecoder("latin8").encoding is "iso-8859-14"
+PASS new TextDecoder("l8").encoding is "iso-8859-14"
+PASS new TextDecoder("iso-8859-16").encoding is "iso-8859-16"
+PASS new TextDecoder("isoir226").encoding is "iso-8859-16"
+PASS new TextDecoder("iso8859162001").encoding is "iso-8859-16"
+PASS new TextDecoder("l10").encoding is "iso-8859-16"
+PASS new TextDecoder("latin10").encoding is "iso-8859-16"
+PASS new TextDecoder("koi8-u").encoding is "koi8-u"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/encoding/duplicate-tec-encodings.html (0 => 224700)
--- trunk/LayoutTests/fast/encoding/duplicate-tec-encodings.html (rev 0)
+++ trunk/LayoutTests/fast/encoding/duplicate-tec-encodings.html 2017-11-10 19:26:25 UTC (rev 224700)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<script>
+description("This test verifies that encodings that used to be supported by TEC on macOS are still supported.");
+
+
+debug("The following encoding names are supported by WebKit cross-platform, but some may be removed at a later time.");
+let validForNow = [
+ {encoding: 'iso-8859-10', aliases: ['iso-8859-10', 'iso8859101992', 'isoir157', 'csisolatin6', 'latin6', 'l6']},
+ {encoding: 'windows-874', aliases: ['iso-8859-11']},
+ {encoding: 'iso-8859-14', aliases: ['iso-8859-14', 'isoceltic', 'iso8859141998', 'isoir199', 'latin8', 'l8']},
+ {encoding: 'iso-8859-16', aliases: ['iso-8859-16', 'isoir226', 'iso8859162001', 'l10', 'latin10']},
+ {encoding: 'koi8-u', aliases: ['koi8-u']}
+];
+
+for (let encoding of validForNow) {
+ for (let alias of encoding.aliases) {
+ let canonical_name_expr = 'new TextDecoder("' + alias + '").encoding';
+ shouldBe(canonical_name_expr, '"' + encoding.encoding + '"');
+ }
+}
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (224699 => 224700)
--- trunk/Source/WebCore/ChangeLog 2017-11-10 19:23:13 UTC (rev 224699)
+++ trunk/Source/WebCore/ChangeLog 2017-11-10 19:26:25 UTC (rev 224700)
@@ -1,3 +1,21 @@
+2017-11-10 Maciej Stachowiak <m...@apple.com>
+
+ Remove TEC decoders that duplicate ICU decoders
+ https://bugs.webkit.org/show_bug.cgi?id=179460
+
+ Reviewed by Darin Adler.
+
+ Test: fast/encoding/duplicate-tec-encodings.html
+
+ * platform/text/TextEncodingRegistry.cpp:
+ (WebCore::checkExistingName): Deleted.
+ (WebCore::addToTextEncodingNameMap): Move the check from checkExistingName here,
+ and make it an ASSERT, since we should now be guaranteed no duplicate encodings.
+ * platform/text/mac/mac-encodings.txt: Remove encodings that duplicate ones we
+ implement with ICU.
+ * platform/text/TextCodecICU.cpp: Add some extra encoding aliases that only TEC
+ knew about.
+
2017-11-10 Alex Christensen <achristen...@webkit.org>
Make CachedResource::redirectReceived asynchronous
Modified: trunk/Source/WebCore/platform/text/TextCodecICU.cpp (224699 => 224700)
--- trunk/Source/WebCore/platform/text/TextCodecICU.cpp 2017-11-10 19:23:13 UTC (rev 224699)
+++ trunk/Source/WebCore/platform/text/TextCodecICU.cpp 2017-11-10 19:26:25 UTC (rev 224700)
@@ -63,7 +63,7 @@
#define DECLARE_ALIASES(encoding, ...) \
static const char* const encoding##_aliases[] { __VA_ARGS__ }
-// From https://encoding.spec.whatwg.org.
+// From https://encoding.spec.whatwg.org. Plus a few extra aliases that macOS had historically from TEC.
DECLARE_ALIASES(IBM866, "866", "cp866", "csibm866");
DECLARE_ALIASES(ISO_8859_2, "csisolatin2", "iso-ir-101", "iso8859-2", "iso88592", "iso_8859-2", "iso_8859-2:1987", "l2", "latin2");
DECLARE_ALIASES(ISO_8859_3, "csisolatin3", "iso-ir-109", "iso8859-3", "iso88593", "iso_8859-3", "iso_8859-3:1988", "l3", "latin3");
@@ -73,10 +73,11 @@
DECLARE_ALIASES(ISO_8859_7, "csisolatingreek", "ecma-118", "elot_928", "greek", "greek8", "iso-ir-126", "iso8859-7", "iso88597", "iso_8859-7", "iso_8859-7:1987", "sun_eu_greek");
DECLARE_ALIASES(ISO_8859_8, "csiso88598e", "csisolatinhebrew", "hebrew", "iso-8859-8-e", "iso-ir-138", "iso8859-8", "iso88598", "iso_8859-8", "iso_8859-8:1988", "visual");
DECLARE_ALIASES(ISO_8859_8_I, "csiso88598i", "logical");
-DECLARE_ALIASES(ISO_8859_10, "csisolatin6", "iso-ir-157", "iso8859-10", "iso885910", "l6", "latin6");
+DECLARE_ALIASES(ISO_8859_10, "csisolatin6", "iso-ir-157", "iso8859-10", "iso885910", "l6", "latin6", "iso8859101992", "isoir157");
DECLARE_ALIASES(ISO_8859_13, "iso8859-13", "iso885913");
-DECLARE_ALIASES(ISO_8859_14, "iso8859-14", "iso885914");
+DECLARE_ALIASES(ISO_8859_14, "iso8859-14", "iso885914", "isoceltic", "iso8859141998", "isoir199", "latin8", "l8");
DECLARE_ALIASES(ISO_8859_15, "csisolatin9", "iso8859-15", "iso885915", "iso_8859-15", "l9");
+DECLARE_ALIASES(ISO_8859_16, "isoir226", "iso8859162001", "l10", "latin10");
DECLARE_ALIASES(KOI8_R, "cskoi8r", "koi", "koi8", "koi8_r");
DECLARE_ALIASES(KOI8_U, "koi8-ru");
DECLARE_ALIASES(macintosh, "csmacintosh", "mac", "x-mac-roman", "macroman", "x-macroman");
@@ -130,7 +131,7 @@
DECLARE_ENCODING_NAME("ISO-8859-13", ISO_8859_13),
DECLARE_ENCODING_NAME("ISO-8859-14", ISO_8859_14),
DECLARE_ENCODING_NAME("ISO-8859-15", ISO_8859_15),
- DECLARE_ENCODING_NAME_NO_ALIASES("ISO-8859-16"),
+ DECLARE_ENCODING_NAME("ISO-8859-16", ISO_8859_16),
DECLARE_ENCODING_NAME("KOI8-R", KOI8_R),
DECLARE_ENCODING_NAME("KOI8-U", KOI8_U),
DECLARE_ENCODING_NAME("macintosh", macintosh),
Modified: trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp (224699 => 224700)
--- trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp 2017-11-10 19:23:13 UTC (rev 224699)
+++ trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp 2017-11-10 19:26:25 UTC (rev 224700)
@@ -113,29 +113,6 @@
static const char* const textEncodingNameBlacklist[] = { "UTF-7", "BOCU-1", "SCSU" };
-#if ERROR_DISABLED
-
-static inline void checkExistingName(const char*, const char*) { }
-
-#else
-
-static void checkExistingName(const char* alias, const char* atomicName)
-{
- const char* oldAtomicName = textEncodingNameMap->get(alias);
- if (!oldAtomicName)
- return;
- if (oldAtomicName == atomicName)
- return;
- // Keep the warning silent about one case where we know this will happen.
- if (strcmp(alias, "ISO-8859-8-I") == 0
- && strcmp(oldAtomicName, "ISO-8859-8-I") == 0
- && strcasecmp(atomicName, "iso-8859-8") == 0)
- return;
- LOG_ERROR("alias %s maps to %s already, but someone is trying to make it map to %s", alias, oldAtomicName, atomicName);
-}
-
-#endif
-
static bool isUndesiredAlias(const char* alias)
{
// Reject aliases with version numbers that are supported by some back-ends (such as "ISO_2022,locale=ja,version=0" in ICU).
@@ -159,7 +136,9 @@
ASSERT(strcmp(alias, name) == 0 || atomicName);
if (!atomicName)
atomicName = name;
- checkExistingName(alias, atomicName);
+
+ ASSERT_WITH_MESSAGE(!textEncodingNameMap->get(alias), "Duplicate text encoding name %s for %s (previously registered as %s)", alias, atomicName, !textEncodingNameMap->get(alias));
+
textEncodingNameMap->add(alias, atomicName);
}
Modified: trunk/Source/WebCore/platform/text/mac/mac-encodings.txt (224699 => 224700)
--- trunk/Source/WebCore/platform/text/mac/mac-encodings.txt 2017-11-10 19:23:13 UTC (rev 224699)
+++ trunk/Source/WebCore/platform/text/mac/mac-encodings.txt 2017-11-10 19:26:25 UTC (rev 224700)
@@ -11,16 +11,11 @@
DOSChineseTrad: cp950
DOSGreek: cp737, ibm737
EUC_TW: EUC-TW
-ISOLatin10: ISO-8859-16
-ISOLatin6: ISO-8859-10
-ISOLatin8: ISO-8859-14
-ISOLatinThai: ISO-8859-11
ISO_2022_JP_3: ISO-2022-JP-3
JIS_C6226_78: JIS_C6226-1978
JIS_X0208_83: JIS_X0208-1983
JIS_X0208_90: JIS_X0208-1990
JIS_X0212_90: JIS_X0212-1990
-KOI8_U: KOI8-U
MacArabic: x-mac-arabic
MacChineseSimp: x-mac-chinesesimp, xmacsimpchinese
MacChineseTrad: x-mac-chinesetrad, xmactradchinese
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes