Bug 234039 - Improve <type="datetime-local"> value parsing and sanitization
Summary: Improve <type="datetime-local"> value parsing and sanitization
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://github.com/whatwg/html/issues...
Keywords: InRadar
Depends on:
Blocks: 233428
  Show dependency treegraph
 
Reported: 2021-12-08 16:21 PST by Chris Dumez
Modified: 2021-12-10 12:39 PST (History)
13 users (show)

See Also:


Attachments
Patch (5.01 KB, patch)
2021-12-08 16:24 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (13.89 KB, patch)
2021-12-09 09:58 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (25.12 KB, patch)
2021-12-09 11:58 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (30.95 KB, patch)
2021-12-09 16:16 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (30.97 KB, patch)
2021-12-09 17:23 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (37.31 KB, patch)
2021-12-10 09:56 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (36.66 KB, patch)
2021-12-10 11:45 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2021-12-08 16:21:38 PST
Allow using a space as date / time separator in <type="datetime-local">, instead of simply allowing a 'T'. This would align our behavior with Gecko and allow us to pass more tests in WPT.
Comment 1 Chris Dumez 2021-12-08 16:24:24 PST
Created attachment 446453 [details]
Patch
Comment 2 Chris Dumez 2021-12-09 09:58:20 PST
Created attachment 446560 [details]
Patch
Comment 3 Chris Dumez 2021-12-09 11:58:42 PST
Created attachment 446583 [details]
Patch
Comment 4 Chris Dumez 2021-12-09 16:16:45 PST
Created attachment 446628 [details]
Patch
Comment 5 Darin Adler 2021-12-09 17:16:26 PST
Comment on attachment 446628 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        This would align our behavior with Gecko and allow us to pass more tests in WPT.

What about specification?

> Source/WebCore/ChangeLog:21
> +        - The output will use the shortest possible string, omitting seconds or milliseconds when 0, as per
> +          https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-normalised-local-date-and-time-string

Good, but not mentioned in the bug title.

> Source/WebCore/ChangeLog:27
> +        Fix bug where we would allow more than 3 digits for the millisecond part of the time (we
> +        would silently ignore follow-up digits instead of failing parsing). This is as per:

Good, but not mentioned in the bug title.

> Source/WebCore/ChangeLog:38
> +        The output will use the shortest possible string, omitting seconds or milliseconds when 0, as per
> +        https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-normalised-local-date-and-time-string

Good, but not mentioned in the bug title.

> Source/WebCore/platform/DateComponents.cpp:483
>                          // Regardless of the number of digits, we only ever parse at most 3. All other
>                          // digits after that are ignored, but the buffer is incremented as if they were
>                          // all parsed.

This comment does not make sense any more and should be deleted.
Comment 6 Chris Dumez 2021-12-09 17:18:53 PST
Comment on attachment 446628 [details]
Patch

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

>> Source/WebCore/ChangeLog:9
>> +        This would align our behavior with Gecko and allow us to pass more tests in WPT.
> 
> What about specification?

Specification allows a space or a 'T' (in line with WPT test):
https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-local-date-and-time-string

Will clarify the change log.

>> Source/WebCore/ChangeLog:38
>> +        https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-normalised-local-date-and-time-string
> 
> Good, but not mentioned in the bug title.

I guess I will need a more generic bug title.

>> Source/WebCore/platform/DateComponents.cpp:483
>>                          // all parsed.
> 
> This comment does not make sense any more and should be deleted.

OK.
Comment 7 Chris Dumez 2021-12-09 17:23:06 PST
Created attachment 446642 [details]
Patch
Comment 8 Chris Dumez 2021-12-10 09:56:04 PST
Created attachment 446746 [details]
Patch
Comment 9 Darin Adler 2021-12-10 10:51:14 PST
Comment on attachment 446746 [details]
Patch

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

> LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:87
> -PASS [INPUT in RADIO status] The checked attribute is false
> +FAIL [INPUT in RADIO status] The checked attribute is false assert_true: The validity.valueMissing should be true. expected true got false

Regression, not progression?
Comment 10 Chris Dumez 2021-12-10 10:52:52 PST
Comment on attachment 446746 [details]
Patch

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

>> LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:87
>> +FAIL [INPUT in RADIO status] The checked attribute is false assert_true: The validity.valueMissing should be true. expected true got false
> 
> Regression, not progression?

Weird, no such failure in the Mac output. I'll investigate.

Thanks for catching.
Comment 11 Chris Dumez 2021-12-10 11:45:28 PST
Created attachment 446771 [details]
Patch
Comment 12 Chris Dumez 2021-12-10 11:46:21 PST
It was just a bad baseline because I had a patch impacting the same test that landed super recently. No issue with the code change itself.
Comment 13 EWS 2021-12-10 12:38:54 PST
Committed r286869 (245100@main): <https://commits.webkit.org/245100@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 446771 [details].
Comment 14 Radar WebKit Bug Importer 2021-12-10 12:39:39 PST
<rdar://problem/86335445>