[webkit-dev] Is MIMETypeRegistry::canShowMIMEType supposed to accept lowercase or unknown case?

Darin Adler darin at apple.com
Fri Feb 12 09:13:36 PST 2016


> On Feb 12, 2016, at 5:33 AM, Konstantin Tokarev <annulen at yandex.ru> wrote:
> 
> In WebProcess/WebPage/WebPage.cpp MIMETypeRegistry::canShowMIMEType seems to be called with argument of unknown case (the same string is then looked up in ASCIICaseInsensitiveHash).
> 
> However, MIMETypeRegistry::canShowMIMEType does a case-sensitive startsWith("text/").
> 
> Should MIMETypeRegistry::canShowMIMEType use startsWithIgnoringASCIICase instead?

Yes.

It’s likely I introduced this problem recently. I changed the semantics of all MIMETypeRegistry functions to work with unknown case. It seems that I missed this one check.

Better test coverage would help here, too; I probably didn’t write enough tests and it would be helpful if we wrote some more. That requires a little research into how these functions are used so we can make tests that show the actual behavior, which I think would be more useful than unit tests of MIMETypeRegistry itself.

— Darin


More information about the webkit-dev mailing list