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.
Created attachment 40337 [details]
Comment on attachment 40337 [details]