Bug 29908 - Make assertion clearer for case where UTF8 is not supported by platform TextCodec
Summary: Make assertion clearer for case where UTF8 is not supported by platform TextC...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-29 17:33 PDT by Yong Li
Modified: 2009-09-29 18:08 PDT (History)
2 users (show)

See Also:


Attachments
the patch (964 bytes, patch)
2009-09-29 17:39 PDT, Yong Li
darin: review+
yong.li.webkit: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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