RESOLVED FIXED 76893
Implement value sanitization algorithm for type=datetime
https://bugs.webkit.org/show_bug.cgi?id=76893
Summary Implement value sanitization algorithm for type=datetime
Kent Tamura
Reported 2012-01-23 20:46:02 PST
http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#date-and-time-state-(type=datetime) > The value sanitization algorithm is as follows: If the value of the element is a valid global date and time string, then adjust the time so that the value represents the same point in time but expressed in the UTC time zone as a valid normalized forced-UTC global date and time string, otherwise, set it to the empty string instead.
Attachments
Patch (18.28 KB, patch)
2012-10-18 19:31 PDT, Kunihiko Sakamoto
no flags
Patch 2 (18.56 KB, patch)
2012-10-18 21:16 PDT, Kunihiko Sakamoto
no flags
Kunihiko Sakamoto
Comment 1 2012-10-18 19:31:53 PDT
Kent Tamura
Comment 2 2012-10-18 20:28:48 PDT
Comment on attachment 169537 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=169537&action=review > LayoutTests/fast/forms/datetime/datetime-value-sanitization-expected.txt:9 > +PASS input.value = "2009-09-07T16:49:00Z"; input.value is "2009-09-07T16:49Z" > +PASS input.value = "2009-09-07T16:49:00.000Z"; input.value is "2009-09-07T16:49Z" Can you preserve trailing zeros of the input datetime values? If we do so, we should do: - Add "SecondFormat m_preferredSecondForamt;" and "SecondFormat preferredSecondFormat() const" to DateComponents - m_preferredSecondFormat is updated in DateComponents::parseTime - DateTimeInputType::sanitizeValue calls date.toString(date.preferredSecondFormat) > LayoutTests/fast/forms/datetime/datetime-value-sanitization.html:1 > +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <!DOCTYPE html> is enough. > LayoutTests/fast/forms/datetime/datetime-value-sanitization.html:8 > +<p id="description"></p> > +<div id="console"></div> Please remove them. They are unnecessary nowadays. > LayoutTests/fast/forms/datetime/datetime-value-sanitization.html:15 > +// Valid values Such labels are useful for test results too. So please print it by debug('Valid values'); > LayoutTests/fast/forms/datetime/datetime-value-sanitization.html:16 > +shouldBe('input.value = "2009-09-07T16:49Z"; input.value', '"2009-09-07T16:49Z"'); should be: shouldBeEqualToString('input.value ...', '2009-09-07T16:49Z'); to avoid ugly nested quotes.
Kunihiko Sakamoto
Comment 3 2012-10-18 20:49:53 PDT
Comment on attachment 169537 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=169537&action=review >> LayoutTests/fast/forms/datetime/datetime-value-sanitization-expected.txt:9 >> +PASS input.value = "2009-09-07T16:49:00.000Z"; input.value is "2009-09-07T16:49Z" > > Can you preserve trailing zeros of the input datetime values? > > If we do so, we should do: > - Add "SecondFormat m_preferredSecondForamt;" and "SecondFormat preferredSecondFormat() const" to DateComponents > - m_preferredSecondFormat is updated in DateComponents::parseTime > - DateTimeInputType::sanitizeValue calls date.toString(date.preferredSecondFormat) The spec says that normalized value is the shortest possible representation of the given time. http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-normalized-forced-utc-global-date-and-time-string Is there a good reason for keeping the second format of the input?
Kent Tamura
Comment 4 2012-10-18 20:56:18 PDT
Comment on attachment 169537 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=169537&action=review >>> LayoutTests/fast/forms/datetime/datetime-value-sanitization-expected.txt:9 >>> +PASS input.value = "2009-09-07T16:49:00.000Z"; input.value is "2009-09-07T16:49Z" >> >> Can you preserve trailing zeros of the input datetime values? >> >> If we do so, we should do: >> - Add "SecondFormat m_preferredSecondForamt;" and "SecondFormat preferredSecondFormat() const" to DateComponents >> - m_preferredSecondFormat is updated in DateComponents::parseTime >> - DateTimeInputType::sanitizeValue calls date.toString(date.preferredSecondFormat) > > The spec says that normalized value is the shortest possible representation of the given time. > http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-normalized-forced-utc-global-date-and-time-string > Is there a good reason for keeping the second format of the input? Oh, I see. It is a standard behavior. So, the C++ part of your patch is ok.
Kunihiko Sakamoto
Comment 5 2012-10-18 21:16:23 PDT
Kunihiko Sakamoto
Comment 6 2012-10-18 21:17:14 PDT
Updated the test. Please take another look.
Kent Tamura
Comment 7 2012-10-18 21:40:36 PDT
Comment on attachment 169541 [details] Patch 2 ok
WebKit Review Bot
Comment 8 2012-10-18 21:45:53 PDT
Comment on attachment 169541 [details] Patch 2 Clearing flags on attachment: 169541 Committed r131853: <http://trac.webkit.org/changeset/131853>
WebKit Review Bot
Comment 9 2012-10-18 21:45:57 PDT
All reviewed patches have been landed. Closing bug.
MarleneCraig
Comment 10 2024-09-13 03:27:07 PDT
RocketPlay Casino is known for its generous bonuses and promotions catering to new and existing players. New players can take advantage of a lucrative welcome bonus, often including a match deposit bonus and free spins. This gives newcomers a great start and allows them to explore the games without risking too much of their money https://rocketplay.com.de/. Existing players are not left out, as RocketPlay offers regular promotions such as reload bonuses, cashback offers, and free spins on popular slots. The casino also has a loyalty program where players earn points for every wager. These points can be exchanged for rewards, adding extra value to your gameplay.
Sophia Carpenter
Comment 11 2024-09-27 00:32:54 PDT
Implementing a value sanitization algorithm for type=datetime is crucial for ensuring that data is properly validated and formatted, particularly when dealing with sensitive time-related inputs in web applications. This practice mitigates risks such as incorrect formatting and potential security vulnerabilities, enhancing the reliability of the system. Proper sanitization aligns with legal compliance efforts, much like the regulations discussed in the article https://northiowatoday.com/2024/08/27/understanding-the-legal-side-of-online-slots-in-australia/, where adherence to strict standards ensures a secure and fair online gaming environment.
Snowmanta
Comment 12 2024-09-30 01:15:26 PDT
RocketPlay provides frequent promotions, including reload bonuses, cashback incentives, and complimentary spins on popular slot games. The casino has a loyalty program that allows players to accumulate points for each bet placed. These points may be redeemed for gifts, enhancing the value of your gameplay. https://drifthunters2.io
JustinPlaying
Comment 13 2024-11-05 01:14:21 PST
RocketPlay Casino is known for its generous bonuses and promotions catering to new and existing players.as well as https://www.funnyshooter2.xyz. New players can take advantage of a lucrative welcome bonus, often including a match deposit bonus and free spins.
Note You need to log in before you can comment on or make changes to this bug.