[webkit-reviews] review granted: [Bug 115487] Move knowledge of PDF/PostScript MIME types into MIMETypeRegistry : [Attachment 200237] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 1 13:45:36 PDT 2013


Darin Adler <darin at apple.com> has granted Tim Horton
<timothy_horton at apple.com>'s request for review:
Bug 115487: Move knowledge of PDF/PostScript MIME types into MIMETypeRegistry
https://bugs.webkit.org/show_bug.cgi?id=115487

Attachment 200237: patch
https://bugs.webkit.org/attachment.cgi?id=200237&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=200237&action=review


> Source/WebCore/platform/MIMETypeRegistry.cpp:361
> +    static const char* types[] = {
> +	   "application/pdf",
> +	   "text/pdf",
> +	   "application/postscript",
> +    };

Why is this marked static? Since the function is called only once, I don’t know
if that’s beneficial. Also could make this more const, const char* const, but
that probably doesn’t matter; it’s usually not important if a local variable is
const.

> Source/WebKit2/UIProcess/WebFrameProxy.cpp:118
> -    return WebContext::pdfAndPostScriptMIMETypes().contains(m_MIMEType);
> +    return MIMETypeRegistry::isPDFOrPostScriptMIMEType(m_MIMEType);

Old code was case folding, but the new function is not case folding. Is that
OK? Does something ensure that the letters in m_MIMEType are lowercase?

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:559
> -	   if ((parameters.mimeType == "application/pdf" || parameters.mimeType
== "application/postscript")
> -	       || (parameters.mimeType.isEmpty() && (path.endsWith(".pdf",
false) || path.endsWith(".ps", false)))) {
> +	   if (MIMETypeRegistry::isPDFOrPostScriptMIMEType(parameters.mimeType)
|| (parameters.mimeType.isEmpty() && (path.endsWith(".pdf", false) ||
path.endsWith(".ps", false)))) {

Old code was case folding, but the new function is not case folding. Is that
OK? Can someone pass WebPage::createPlugin a MIME type that contains uppercase
letters?


More information about the webkit-reviews mailing list