Bug 29908

Summary: Make assertion clearer for case where UTF8 is not supported by platform TextCodec
Product: WebKit Reporter: Yong Li <yong.li.webkit>
Component: TextAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, staikos
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
the patch darin: review+, yong.li.webkit: commit-queue-

Description Yong Li 2009-09-29 17:33:16 PDT
UTF8Encoding() returns a static TextEncoding object. But if "UTF-8" is not registered by platform TextCodec, the encoding object will contain a null "m_name" and newTextCodec() will get a null "factory" function.

There's already an ASSERT(factory.function) in newTextCodec(), but at that point, the encoding name is null. It's not so clear that the crash is due to missing UTF-8 support. ASSERT(factory.function) is supposed to detect the problem that the platform TextCodec forgets to register a factory for an encoding it has registered.

So we think adding an ASSERT to UTF8Encoding() can be helpful.
Comment 1 Yong Li 2009-09-29 17:39:43 PDT
Created attachment 40337 [details]
the patch

the patch
Comment 2 Darin Adler 2009-09-29 17:40:55 PDT
Comment on attachment 40337 [details]
the patch

Seems fine.
Comment 3 Yong Li 2009-09-29 18:08:34 PDT
Landed @48913