diff options
author | Steve Block <steveblock@google.com> | 2009-11-05 09:23:40 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-11-10 22:41:12 +0000 |
commit | cac0f67c402d107cdb10971b95719e2ff9c7c76b (patch) | |
tree | d182c7f87211c6f201a5f038e332336493ebdbe7 /WebCore/platform/text/TextEncodingRegistry.cpp | |
parent | 4b2ef0f288e7c6c4602f621b7a0e9feed304b70e (diff) | |
download | external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.zip external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.gz external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.bz2 |
Merge webkit.org at r50258 : Initial merge by git.
Change-Id: I1a9e1dc4ed654b69174ad52a4f031a07240f37b0
Diffstat (limited to 'WebCore/platform/text/TextEncodingRegistry.cpp')
-rw-r--r-- | WebCore/platform/text/TextEncodingRegistry.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/WebCore/platform/text/TextEncodingRegistry.cpp b/WebCore/platform/text/TextEncodingRegistry.cpp index 5d82511..d3e2965 100644 --- a/WebCore/platform/text/TextEncodingRegistry.cpp +++ b/WebCore/platform/text/TextEncodingRegistry.cpp @@ -129,6 +129,10 @@ static TextEncodingNameMap* textEncodingNameMap; static TextCodecMap* textCodecMap; static bool didExtendTextCodecMaps; +static const char* const textEncodingNameBlacklist[] = { + "UTF-7" +}; + #if ERROR_DISABLED static inline void checkExistingName(const char*, const char*) { } @@ -171,6 +175,30 @@ static void addToTextCodecMap(const char* name, NewTextCodecFunction function, c textCodecMap->add(atomicName, TextCodecFactory(function, additionalData)); } +static void pruneBlacklistedCodecs() +{ + size_t blacklistedCodecListLength = sizeof(textEncodingNameBlacklist) / sizeof(textEncodingNameBlacklist[0]); + for (size_t i = 0; i < blacklistedCodecListLength; ++i) { + const char* atomicName = textEncodingNameMap->get(textEncodingNameBlacklist[i]); + if (!atomicName) + continue; + + Vector<const char*> names; + TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin(); + TextEncodingNameMap::const_iterator end = textEncodingNameMap->end(); + for (; it != end; ++it) { + if (it->second == atomicName) + names.append(it->first); + } + + size_t length = names.size(); + for (size_t j = 0; j < length; ++j) + textEncodingNameMap->remove(names[j]); + + textCodecMap->remove(atomicName); + } +} + static void buildBaseTextCodecMaps() { ASSERT(isMainThread()); @@ -221,6 +249,8 @@ static void extendTextCodecMaps() TextCodecWince::registerExtendedEncodingNames(addToTextEncodingNameMap); TextCodecWince::registerExtendedCodecs(addToTextCodecMap); #endif + + pruneBlacklistedCodecs(); } PassOwnPtr<TextCodec> newTextCodec(const TextEncoding& encoding) |