[webkit-reviews] review granted: [Bug 70095] Reject invalid MIME type strings for a file selection dialog parameter : [Attachment 111406] Patch 2

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 18 09:56:27 PDT 2011


Darin Adler <darin at apple.com> has granted Kent Tamura <tkent at chromium.org>'s
request for review:
Bug 70095: Reject invalid MIME type strings for a file selection dialog
parameter
https://bugs.webkit.org/show_bug.cgi?id=70095

Attachment 111406: Patch 2
https://bugs.webkit.org/attachment.cgi?id=111406&action=review

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


> Source/WebCore/html/HTMLInputElement.cpp:1310
> +static bool isRFC2616TokenCharacter(UChar ch)

Since this function is used only in one place, it would be better to mark it
inline for compilers that aren’t as aggressive about inlining such things.

> Source/WebCore/html/HTMLInputElement.cpp:1312
> +    return isASCII(ch) && ch > ' ' && ch != '"' && ch != '(' && ch != ')' &&
ch != ',' && ch != '/' && (ch < ':' || ch > '@') && (ch < '[' || ch > ']') &&
ch != '{' && ch != '}' && ch != 0x7f;

If there is a speed issue at all, a 128-byte array is a much faster way to
implement this after the isASCII test.

> Source/WebCore/html/HTMLInputElement.cpp:1334
> +	       if (j != slashPosition &&
!isRFC2616TokenCharacter(trimmedMimeType[j])) {

You would get slightly faster performance if you reversed the && here.


More information about the webkit-reviews mailing list