Bug 103018 - Correct input[type=number] value sanitization for user-input
Summary: Correct input[type=number] value sanitization for user-input
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kent Tamura
URL:
Keywords: WebExposed
Depends on:
Blocks: 102861
  Show dependency treegraph
 
Reported: 2012-11-21 21:58 PST by Kent Tamura
Modified: 2012-11-23 05:12 PST (History)
7 users (show)

See Also:


Attachments
Patch (7.48 KB, patch)
2012-11-21 22:14 PST, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch 2 (7.49 KB, patch)
2012-11-21 22:23 PST, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch 3 (12.57 KB, patch)
2012-11-21 23:49 PST, Kent Tamura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2012-11-21 21:58:04 PST
1. Open a page with input[type=number]
2. Type "-1" into the number field
3. Additionally type "abc" into the number field

Expected result:
 Because the typed string is "-1abc" and it's not a valid number, HTMLInputElement::value should have sanitized value, "".

Actual result:
  HTMLInputElement::value is "-1".

Note: Opera's behavior is the "Expected result".
Comment 1 Kent Tamura 2012-11-21 22:14:47 PST
Created attachment 175587 [details]
Patch
Comment 2 Early Warning System Bot 2012-11-21 22:22:20 PST
Comment on attachment 175587 [details]
Patch

Attachment 175587 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/14950260
Comment 3 Kent Tamura 2012-11-21 22:23:50 PST
Created attachment 175588 [details]
Patch 2
Comment 4 Kentaro Hara 2012-11-21 23:06:34 PST
Comment on attachment 175588 [details]
Patch 2

View in context: https://bugs.webkit.org/attachment.cgi?id=175588&action=review

Looks OK.

> Source/WebCore/ChangeLog:10
> +        sanitization algorithm defined by the HTML standard, and Opera's

You can add the link to the spec in ChangeLog.
Comment 5 Kent Tamura 2012-11-21 23:49:53 PST
Created attachment 175602 [details]
Patch 3
Comment 6 Kent Tamura 2012-11-21 23:51:22 PST
Thank you for the review.

I updated ChangeLog, and revised the patch because I found HTMLInputElement::isAcceptableValue and InputType::isAcceptableValue were unnecessary any more.
Comment 7 WebKit Review Bot 2012-11-22 22:01:59 PST
Comment on attachment 175602 [details]
Patch 3

Attachment 175602 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/14965574

New failing tests:
inspector-protocol/debugger-terminate-dedicated-worker-while-paused.html
Comment 8 WebKit Review Bot 2012-11-23 05:12:31 PST
Comment on attachment 175602 [details]
Patch 3

Clearing flags on attachment: 175602

Committed r135598: <http://trac.webkit.org/changeset/135598>
Comment 9 WebKit Review Bot 2012-11-23 05:12:36 PST
All reviewed patches have been landed.  Closing bug.