PKGBUILDs/extra/chromium/fix-the-way-to-handle-codecs-in-the-system-icu.patch
2023-01-25 12:40:26 +00:00

60 lines
2.4 KiB
Diff

From 4885090741554be61cb2ed10194cefb29bf8be64 Mon Sep 17 00:00:00 2001
From: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Date: Wed, 11 Jan 2023 23:51:39 +0000
Subject: [PATCH] Fix the way to handle codecs in the system icu.
The previous code does not register codecs whose standard name is
different from the bundled ICU. As a result, looking up such codecs
seems to fail unexpectedly.
Bug: 1382032
Change-Id: I8a61f77d0f70104415d24dd954b3b7061ffca556
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4154277
Reviewed-by: Kent Tamura <tkent@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091571}
---
.../renderer/platform/wtf/text/text_codec_icu.cc | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc b/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
index a70b359984f..33ce43f3563 100644
--- a/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
+++ b/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
@@ -116,6 +116,10 @@ void TextCodecICU::RegisterEncodingNames(EncodingNameRegistrar registrar) {
continue;
}
#endif
+ // Avoid codecs supported by `TextCodecCJK`.
+ if (is_text_codec_cjk_enabled && TextCodecCJK::IsSupported(standard_name)) {
+ continue;
+ }
// A number of these aliases are handled in Chrome's copy of ICU, but
// Chromium can be compiled with the system ICU.
@@ -144,12 +148,13 @@ void TextCodecICU::RegisterEncodingNames(EncodingNameRegistrar registrar) {
}
#endif
- if (is_text_codec_cjk_enabled && TextCodecCJK::IsSupported(standard_name)) {
- continue;
+ // Avoid registering codecs registered by
+ // `TextCodecCJK::RegisterEncodingNames`.
+ if (!is_text_codec_cjk_enabled ||
+ !TextCodecCJK::IsSupported(standard_name)) {
+ registrar(standard_name, standard_name);
}
- registrar(standard_name, standard_name);
-
uint16_t num_aliases = ucnv_countAliases(name, &error);
DCHECK(U_SUCCESS(error));
if (U_SUCCESS(error))
@@ -289,6 +294,7 @@ void TextCodecICU::RegisterCodecs(TextCodecRegistrar registrar) {
continue;
}
#endif
+ // Avoid codecs supported by `TextCodecCJK`.
if (is_text_codec_cjk_enabled && TextCodecCJK::IsSupported(standard_name)) {
continue;
}