Changeset 103957 in webkit
- Timestamp:
- Jan 3, 2012 12:21:44 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r103953 r103957 1 2011-12-22 Joseph Pecoraro <pecoraro@apple.com> 2 3 Implement Date and Time Input Value Sanitization 4 https://bugs.webkit.org/show_bug.cgi?id=59951 5 6 Update ValidityState typeMismatch tests for date types, since 7 setting an invalid value now sanitized to the empty string. 8 So, what used to be an invalid value with a typeMismatch is 9 now a valid empty string and there is never a typeMismatch. 10 11 - for rangeOverflow / rangeUnderflow tests update the 12 test to point out when a value was sanitized. 13 - for typeMismatch tests, typeMismatch can no longer 14 happen for sanitized values. Change the test to output 15 if the value was sanitized or not and ensure that 16 we are never in a typeMismatch state. Disabled inputs 17 are also sanitized when their value changes. 18 19 Reviewed by Kent Tamura. 20 21 * fast/forms/date/ValidityState-rangeOverflow-date-expected.txt: 22 * fast/forms/date/ValidityState-rangeOverflow-date.html: 23 * fast/forms/date/ValidityState-rangeUnderflow-date-expected.txt: 24 * fast/forms/date/ValidityState-rangeUnderflow-date.html: 25 * fast/forms/date/ValidityState-typeMismatch-date-expected.txt: 26 * fast/forms/date/ValidityState-typeMismatch-date.html: 27 * fast/forms/datetime/ValidityState-rangeOverflow-datetime-expected.txt: 28 * fast/forms/datetime/ValidityState-rangeOverflow-datetime.html: 29 * fast/forms/datetime/ValidityState-rangeUnderflow-datetime-expected.txt: 30 * fast/forms/datetime/ValidityState-rangeUnderflow-datetime.html: 31 * fast/forms/datetime/ValidityState-typeMismatch-datetime-expected.txt: 32 * fast/forms/datetime/ValidityState-typeMismatch-datetime.html: 33 * fast/forms/datetimelocal/ValidityState-rangeOverflow-datetimelocal-expected.txt: 34 * fast/forms/datetimelocal/ValidityState-rangeOverflow-datetimelocal.html: 35 * fast/forms/datetimelocal/ValidityState-rangeUnderflow-datetimelocal-expected.txt: 36 * fast/forms/datetimelocal/ValidityState-rangeUnderflow-datetimelocal.html: 37 * fast/forms/datetimelocal/ValidityState-typeMismatch-datetimelocal-expected.txt: 38 * fast/forms/datetimelocal/ValidityState-typeMismatch-datetimelocal.html: 39 * fast/forms/month/ValidityState-rangeOverflow-month-expected.txt: 40 * fast/forms/month/ValidityState-rangeOverflow-month.html: 41 * fast/forms/month/ValidityState-rangeUnderflow-month-expected.txt: 42 * fast/forms/month/ValidityState-rangeUnderflow-month.html: 43 * fast/forms/month/ValidityState-typeMismatch-month-expected.txt: 44 * fast/forms/month/ValidityState-typeMismatch-month.html: 45 * fast/forms/time/ValidityState-rangeOverflow-time-expected.txt: 46 * fast/forms/time/ValidityState-rangeOverflow-time.html: 47 * fast/forms/time/ValidityState-rangeUnderflow-time-expected.txt: 48 * fast/forms/time/ValidityState-rangeUnderflow-time.html: 49 * fast/forms/time/ValidityState-typeMismatch-time-expected.txt: 50 * fast/forms/time/ValidityState-typeMismatch-time.html: 51 * fast/forms/week/ValidityState-rangeOverflow-week-expected.txt: 52 * fast/forms/week/ValidityState-rangeOverflow-week.html: 53 * fast/forms/week/ValidityState-rangeUnderflow-week-expected.txt: 54 * fast/forms/week/ValidityState-rangeUnderflow-week.html: 55 * fast/forms/week/ValidityState-typeMismatch-week-expected.txt: 56 * fast/forms/week/ValidityState-typeMismatch-week.html: 57 1 58 2012-01-03 Alexis Menard <alexis.menard@openbossa.org> 2 59 -
trunk/LayoutTests/fast/forms/date/ValidityState-rangeOverflow-date-expected.txt
r92819 r103957 10 10 PASS The value "2010-01-27" doesn't overflow the maximum value "2010-01-28". 11 11 PASS The value "2010-01-27" doesn't overflow the maximum value "2011-01-26". 12 PASS The value " foo" doesn't overflow the maximum value "2011-01-26".12 PASS The value "" sanitized from "foo" doesn't overflow the maximum value "2011-01-26". 13 13 PASS The value "2010-01-27" doesn't overflow the maximum value "0000-01-01". 14 14 PASS The value "2010-01-27" overflows the maximum value "2010-01-26". -
trunk/LayoutTests/fast/forms/date/ValidityState-rangeOverflow-date.html
r98407 r103957 27 27 } 28 28 29 function checkNotOverflow(value, max, disabled )29 function checkNotOverflow(value, max, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var overflow = input.validity.rangeOverflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (overflow ? 'overflows' : 'doesn\'t overflow') + 37 38 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotOverflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotOverflow(value, max, disabled, true); 42 49 } 43 50 … … 51 58 checkNotOverflow('2010-01-27', '2010-01-28'); 52 59 checkNotOverflow('2010-01-27', '2011-01-26'); 53 check NotOverflow('foo', '2011-01-26');60 checkSanitizedValueNotOverflow('foo', '2011-01-26'); 54 61 checkNotOverflow('2010-01-27', '0000-01-01'); // Too small max value. 55 62 -
trunk/LayoutTests/fast/forms/date/ValidityState-rangeUnderflow-date-expected.txt
r92819 r103957 11 11 PASS The value "2010-01-27" doesn't underflow the minimum value "2010-01-26". 12 12 PASS The value "2010-01-27" doesn't underflow the minimum value "2009-01-28". 13 PASS The value " foo" doesn't underflow the minimum value "2011-01-26".13 PASS The value "" sanitized from "foo" doesn't underflow the minimum value "2011-01-26". 14 14 PASS The value "2010-01-27" undeflows the minimum value "2010-01-28". 15 15 PASS The value "9999-01-01" undeflows the minimum value "10000-12-31". -
trunk/LayoutTests/fast/forms/date/ValidityState-rangeUnderflow-date.html
r98407 r103957 27 27 } 28 28 29 function checkNotUnderflow(value, min, disabled )29 function checkNotUnderflow(value, min, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var underflow = input.validity.rangeUnderflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (underflow ? 'underflows' : 'doesn\'t underflow') + 37 38 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotUnderflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotUnderflow(value, max, disabled, true); 42 49 } 43 50 … … 54 61 checkNotUnderflow('2010-01-27', '2010-01-26'); 55 62 checkNotUnderflow('2010-01-27', '2009-01-28'); 56 check NotUnderflow('foo', '2011-01-26');63 checkSanitizedValueNotUnderflow('foo', '2011-01-26'); 57 64 58 65 // Underflow cases -
trunk/LayoutTests/fast/forms/date/ValidityState-typeMismatch-date-expected.txt
r92819 r103957 24 24 PASS "2008-02-29" is a correct valid date string. 25 25 PASS "2000-02-29" is a correct valid date string. 26 PASS " 2009-09-07 " is a correct invalid date string.27 PASS "a" is a correct invalid date string.28 PASS "-1-09-07" is a correct invalid date string.29 PASS "0000-12-31" is a correct invalid date string.30 PASS "0000-01-01" is a correct invalid date string.31 PASS "275760-09-14" is a correct invalid date string.32 PASS "2147483648-12-31" is a correct invalid date string.33 PASS "2009/09/07" is a correct invalid date string.34 PASS "20090907" is a correct invalid date string.35 PASS "2009--2-07" is a correct invalid date string.36 PASS "2009-00-07" is a correct invalid date string.37 PASS "2009-13-07" is a correct invalid date string.38 PASS "2009-xx-30" is a correct invalid date string.39 PASS "2009-01-32" is a correct invalid date string.40 PASS "2009-02-29" is a correct invalid date string.41 PASS "2009-03-32" is a correct invalid date string.42 PASS "2009-04-31" is a correct invalid date string.43 PASS "2009-05-32" is a correct invalid date string.44 PASS "2009-06-31" is a correct invalid date string.45 PASS "2009-07-32" is a correct invalid date string.46 PASS "2009-08-32" is a correct invalid date string.47 PASS "2009-09-31" is a correct invalid date string.48 PASS "2009-10-32" is a correct invalid date string.49 PASS "2009-11-31" is a correct invalid date string.50 PASS "2009-12-32" is a correct invalid date string.51 PASS "2100-02-29" is a correct invalid date string.52 PASS "2009-09-00" is a correct invalid date string.53 PASS "2009-09-" is a correct invalid date string.54 PASS "2009-09-7" is a correct invalid date string.55 PASS "2009-09-001" is a correct invalid date string.56 PASS "2009-09-xx" is a correct invalid date string.57 PASS "2009-09" is a correct invalid date string.58 PASS "2009" is a correct invalid date string.59 PASS "2009-09" is a correct valid date string whendisabled.26 PASS " 2009-09-07 " is an invalid date string and was sanitized. 27 PASS "a" is an invalid date string and was sanitized. 28 PASS "-1-09-07" is an invalid date string and was sanitized. 29 PASS "0000-12-31" is an invalid date string and was sanitized. 30 PASS "0000-01-01" is an invalid date string and was sanitized. 31 PASS "275760-09-14" is an invalid date string and was sanitized. 32 PASS "2147483648-12-31" is an invalid date string and was sanitized. 33 PASS "2009/09/07" is an invalid date string and was sanitized. 34 PASS "20090907" is an invalid date string and was sanitized. 35 PASS "2009--2-07" is an invalid date string and was sanitized. 36 PASS "2009-00-07" is an invalid date string and was sanitized. 37 PASS "2009-13-07" is an invalid date string and was sanitized. 38 PASS "2009-xx-30" is an invalid date string and was sanitized. 39 PASS "2009-01-32" is an invalid date string and was sanitized. 40 PASS "2009-02-29" is an invalid date string and was sanitized. 41 PASS "2009-03-32" is an invalid date string and was sanitized. 42 PASS "2009-04-31" is an invalid date string and was sanitized. 43 PASS "2009-05-32" is an invalid date string and was sanitized. 44 PASS "2009-06-31" is an invalid date string and was sanitized. 45 PASS "2009-07-32" is an invalid date string and was sanitized. 46 PASS "2009-08-32" is an invalid date string and was sanitized. 47 PASS "2009-09-31" is an invalid date string and was sanitized. 48 PASS "2009-10-32" is an invalid date string and was sanitized. 49 PASS "2009-11-31" is an invalid date string and was sanitized. 50 PASS "2009-12-32" is an invalid date string and was sanitized. 51 PASS "2100-02-29" is an invalid date string and was sanitized. 52 PASS "2009-09-00" is an invalid date string and was sanitized. 53 PASS "2009-09-" is an invalid date string and was sanitized. 54 PASS "2009-09-7" is an invalid date string and was sanitized. 55 PASS "2009-09-001" is an invalid date string and was sanitized. 56 PASS "2009-09-xx" is an invalid date string and was sanitized. 57 PASS "2009-09" is an invalid date string and was sanitized. 58 PASS "2009" is an invalid date string and was sanitized. 59 PASS "2009-09" is an invalid date string and was sanitized while disabled. 60 60 PASS successfullyParsed is true 61 61 -
trunk/LayoutTests/fast/forms/date/ValidityState-typeMismatch-date.html
r98407 r103957 12 12 i.type = 'date'; 13 13 14 function check(value, mismatchExpected,disabled)14 function check(value, disabled) 15 15 { 16 16 i.value = value; 17 17 i.disabled = !!disabled; 18 var actual = i.validity.typeMismatch; 19 var didPass = actual == mismatchExpected; 20 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' date string' + (disabled ? ' when disabled.' : '.'); 21 if (didPass) 22 testPassed(resultText); 23 else 24 testFailed(resultText); 18 19 if (i.validity.typeMismatch) 20 testFailed('"' + value + '" had typeMismatch. This should not happen with sanitization.'); 25 21 } 26 22 27 function shouldBeValid(value , disabled)23 function shouldBeValid(value) 28 24 { 29 check(value, false, disabled); 25 check(value); 26 if ((value === '' && i.value === '') || (value !== '' && i.value !== "")) 27 testPassed('"' + value + '" is a correct valid date string.'); 28 else 29 testFailed('"' + value + '" is a valid date string that failed to be set on the input.'); 30 30 } 31 31 32 function shouldBeInvalid(value )32 function shouldBeInvalid(value, disabled) 33 33 { 34 check(value, true); 34 check(value, disabled); 35 if (i.value === '') 36 testPassed('"' + value + '" is an invalid date string and was sanitized' + (disabled ? ' while disabled' : '') + '.'); 37 else 38 testFailed('"' + value + '" is an invalid date string and was not sanitized' + (disabled ? ' while disabled' : '') + '.'); 35 39 } 36 40 … … 93 97 94 98 // Disabled 95 shouldBe Valid('2009-09', true);99 shouldBeInvalid('2009-09', true); 96 100 </script> 97 101 <script src="../../js/resources/js-test-post.js"></script> -
trunk/LayoutTests/fast/forms/datetime/ValidityState-rangeOverflow-datetime-expected.txt
r92762 r103957 10 10 PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "2010-01-27T12:34:56Z". 11 11 PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "2011-01-26T12:34Z". 12 PASS The value " foo" doesn't overflow the maximum value "2011-01-26T12:34Z".12 PASS The value "" sanitized from "foo" doesn't overflow the maximum value "2011-01-26T12:34Z". 13 13 PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "0000-01-01T00:00Z". 14 14 PASS The value "2010-01-27T12:34Z" overflows the maximum value "2010-01-26T12:33:59.999Z". -
trunk/LayoutTests/fast/forms/datetime/ValidityState-rangeOverflow-datetime.html
r98407 r103957 27 27 } 28 28 29 function checkNotOverflow(value, max, disabled )29 function checkNotOverflow(value, max, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var overflow = input.validity.rangeOverflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (overflow ? 'overflows' : 'doesn\'t overflow') + 37 38 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotOverflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotOverflow(value, max, disabled, true); 42 49 } 43 50 … … 51 58 checkNotOverflow('2010-01-27T12:34Z', '2010-01-27T12:34:56Z'); 52 59 checkNotOverflow('2010-01-27T12:34Z', '2011-01-26T12:34Z'); 53 check NotOverflow('foo', '2011-01-26T12:34Z');60 checkSanitizedValueNotOverflow('foo', '2011-01-26T12:34Z'); 54 61 checkNotOverflow('2010-01-27T12:34Z', '0000-01-01T00:00Z'); // Too small max value. 55 62 -
trunk/LayoutTests/fast/forms/datetime/ValidityState-rangeUnderflow-datetime-expected.txt
r92762 r103957 11 11 PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "2010-01-26T00:00Z". 12 12 PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "2009-01-28T00:00Z". 13 PASS The value " foo" doesn't underflow the minimum value "2011-01-26T00:00Z".13 PASS The value "" sanitized from "foo" doesn't underflow the minimum value "2011-01-26T00:00Z". 14 14 PASS The value "2010-01-27T12:34Z" undeflows the minimum value "2010-01-27T13:00Z". 15 15 PASS The value "9999-01-01T12:00Z" undeflows the minimum value "10000-12-31T12:00Z". -
trunk/LayoutTests/fast/forms/datetime/ValidityState-rangeUnderflow-datetime.html
r98407 r103957 27 27 } 28 28 29 function checkNotUnderflow(value, min, disabled )29 function checkNotUnderflow(value, min, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var underflow = input.validity.rangeUnderflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (underflow ? 'underflows' : 'doesn\'t underflow') + 37 38 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotUnderflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotUnderflow(value, max, disabled, true); 42 49 } 43 50 … … 54 61 checkNotUnderflow('2010-01-27T12:34Z', '2010-01-26T00:00Z'); 55 62 checkNotUnderflow('2010-01-27T12:34Z', '2009-01-28T00:00Z'); 56 check NotUnderflow('foo', '2011-01-26T00:00Z');63 checkSanitizedValueNotUnderflow('foo', '2011-01-26T00:00Z'); 57 64 58 65 // Underflow cases -
trunk/LayoutTests/fast/forms/datetime/ValidityState-typeMismatch-datetime-expected.txt
r92762 r103957 17 17 PASS "0001-01-01T01:30+01:30" is a correct valid datetime string. 18 18 PASS "0001-01-01T00:00+01:00" is a correct valid datetime string. 19 PASS " 2009-09-07T16:49Z " is a correct invalid datetime string.20 PASS "2009-09-07T16:49z" is a correct invalid datetime string.21 PASS "2009-09-07t16:49Z" is a correct invalid datetime string.22 PASS "2009-09-07T16:49" is a correct invalid datetime string.23 PASS "2009/09/07T16:49Z" is a correct invalid datetime string.24 PASS "a" is a correct invalid datetime string.25 PASS "-1-09-07T16:49Z" is a correct invalid datetime string.26 PASS "2009-09-07T16:49+23" is a correct invalid datetime string.27 PASS "2009-09-07T16:49+23:" is a correct invalid datetime string.28 PASS "2009-09-07T16:49+24:00" is a correct invalid datetime string.29 PASS "2009-09-07T16:49+23:60" is a correct invalid datetime string.30 PASS "2009-09-07T16:49-23" is a correct invalid datetime string.31 PASS "2009-09-07T16:49-23:" is a correct invalid datetime string.32 PASS "2009-09-07T16:49-24:00" is a correct invalid datetime string.33 PASS "2009-09-07T16:49-23:60" is a correct invalid datetime string.34 PASS "0000-12-31T23:59:59Z" is a correct invalid datetime string.35 PASS "2147483647-12-31T23:59-00:01" is a correct invalid datetime string.36 PASS "2147483648-01-01T00:00:00Z" is a correct invalid datetime string.37 PASS "invalid" is a correct valid datetime string whendisabled.19 PASS " 2009-09-07T16:49Z " is an invalid datetime string and was sanitized. 20 PASS "2009-09-07T16:49z" is an invalid datetime string and was sanitized. 21 PASS "2009-09-07t16:49Z" is an invalid datetime string and was sanitized. 22 PASS "2009-09-07T16:49" is an invalid datetime string and was sanitized. 23 PASS "2009/09/07T16:49Z" is an invalid datetime string and was sanitized. 24 PASS "a" is an invalid datetime string and was sanitized. 25 PASS "-1-09-07T16:49Z" is an invalid datetime string and was sanitized. 26 PASS "2009-09-07T16:49+23" is an invalid datetime string and was sanitized. 27 PASS "2009-09-07T16:49+23:" is an invalid datetime string and was sanitized. 28 PASS "2009-09-07T16:49+24:00" is an invalid datetime string and was sanitized. 29 PASS "2009-09-07T16:49+23:60" is an invalid datetime string and was sanitized. 30 PASS "2009-09-07T16:49-23" is an invalid datetime string and was sanitized. 31 PASS "2009-09-07T16:49-23:" is an invalid datetime string and was sanitized. 32 PASS "2009-09-07T16:49-24:00" is an invalid datetime string and was sanitized. 33 PASS "2009-09-07T16:49-23:60" is an invalid datetime string and was sanitized. 34 PASS "0000-12-31T23:59:59Z" is an invalid datetime string and was sanitized. 35 PASS "2147483647-12-31T23:59-00:01" is an invalid datetime string and was sanitized. 36 PASS "2147483648-01-01T00:00:00Z" is an invalid datetime string and was sanitized. 37 PASS "invalid" is an invalid datetime string and was sanitized while disabled. 38 38 PASS successfullyParsed is true 39 39 -
trunk/LayoutTests/fast/forms/datetime/ValidityState-typeMismatch-datetime.html
r98407 r103957 12 12 i.type = 'datetime'; 13 13 14 function check(value, mismatchExpected,disabled)14 function check(value, disabled) 15 15 { 16 16 i.value = value; 17 17 i.disabled = !!disabled; 18 var actual = i.validity.typeMismatch; 19 var didPass = actual == mismatchExpected; 20 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' datetime string' + (disabled ? ' when disabled.' : '.'); 21 if (didPass) 22 testPassed(resultText); 23 else 24 testFailed(resultText); 18 19 if (i.validity.typeMismatch) 20 testFailed('"' + value + '" had typeMismatch. This should not happen with sanitization.'); 25 21 } 26 22 27 function shouldBeValid(value , disabled)23 function shouldBeValid(value) 28 24 { 29 check(value, false, disabled); 25 check(value); 26 if ((value === '' && i.value === '') || (value !== '' && i.value !== "")) 27 testPassed('"' + value + '" is a correct valid datetime string.'); 28 else 29 testFailed('"' + value + '" is a valid datetime string that failed to be set on the input.'); 30 30 } 31 31 32 function shouldBeInvalid(value )32 function shouldBeInvalid(value, disabled) 33 33 { 34 check(value, true); 34 check(value, disabled); 35 if (i.value === '') 36 testPassed('"' + value + '" is an invalid datetime string and was sanitized' + (disabled ? ' while disabled' : '') + '.'); 37 else 38 testFailed('"' + value + '" is an invalid datetime string and was not sanitized' + (disabled ? ' while disabled' : '') + '.'); 35 39 } 36 40 … … 71 75 72 76 // Disabled 73 shouldBe Valid('invalid', true);77 shouldBeInvalid('invalid', true); 74 78 </script> 75 79 <script src="../../js/resources/js-test-post.js"></script> -
trunk/LayoutTests/fast/forms/datetimelocal/ValidityState-rangeOverflow-datetimelocal-expected.txt
r92754 r103957 10 10 PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "2010-01-27T12:34:56". 11 11 PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "2011-01-26T12:34". 12 PASS The value " foo" doesn't overflow the maximum value "2011-01-26T12:34".12 PASS The value "" sanitized from "foo" doesn't overflow the maximum value "2011-01-26T12:34". 13 13 PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "0000-01-01T00:00". 14 14 PASS The value "2010-01-27T12:34" overflows the maximum value "2010-01-26T12:33:59.999". -
trunk/LayoutTests/fast/forms/datetimelocal/ValidityState-rangeOverflow-datetimelocal.html
r98407 r103957 27 27 } 28 28 29 function checkNotOverflow(value, max, disabled )29 function checkNotOverflow(value, max, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var overflow = input.validity.rangeOverflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (overflow ? 'overflows' : 'doesn\'t overflow') + 37 38 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotOverflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotOverflow(value, max, disabled, true); 42 49 } 43 50 … … 51 58 checkNotOverflow('2010-01-27T12:34', '2010-01-27T12:34:56'); 52 59 checkNotOverflow('2010-01-27T12:34', '2011-01-26T12:34'); 53 check NotOverflow('foo', '2011-01-26T12:34');60 checkSanitizedValueNotOverflow('foo', '2011-01-26T12:34'); 54 61 checkNotOverflow('2010-01-27T12:34', '0000-01-01T00:00'); // Too small max value. 55 62 -
trunk/LayoutTests/fast/forms/datetimelocal/ValidityState-rangeUnderflow-datetimelocal-expected.txt
r92754 r103957 11 11 PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "2010-01-26T00:00". 12 12 PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "2009-01-28T00:00". 13 PASS The value " foo" doesn't underflow the minimum value "2011-01-26T00:00".13 PASS The value "" sanitized from "foo" doesn't underflow the minimum value "2011-01-26T00:00". 14 14 PASS The value "2010-01-27T12:34" undeflows the minimum value "2010-01-27T13:00". 15 15 PASS The value "9999-01-01T12:00" undeflows the minimum value "10000-12-31T12:00". -
trunk/LayoutTests/fast/forms/datetimelocal/ValidityState-rangeUnderflow-datetimelocal.html
r98407 r103957 27 27 } 28 28 29 function checkNotUnderflow(value, min, disabled )29 function checkNotUnderflow(value, min, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var underflow = input.validity.rangeUnderflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (underflow ? 'underflows' : 'doesn\'t underflow') + 37 38 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotUnderflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotUnderflow(value, max, disabled, true); 42 49 } 43 50 … … 54 61 checkNotUnderflow('2010-01-27T12:34', '2010-01-26T00:00'); 55 62 checkNotUnderflow('2010-01-27T12:34', '2009-01-28T00:00'); 56 check NotUnderflow('foo', '2011-01-26T00:00');63 checkSanitizedValueNotUnderflow('foo', '2011-01-26T00:00'); 57 64 58 65 // Underflow cases -
trunk/LayoutTests/fast/forms/datetimelocal/ValidityState-typeMismatch-datetimelocal-expected.txt
r92754 r103957 13 13 PASS "275760-09-13T00:00:00.000" is a correct valid datetime-local string. 14 14 PASS "0001-01-01T00:00:00.000" is a correct valid datetime-local string. 15 PASS " 2009-09-07T16:49 " is a correct invalid datetime-local string.16 PASS "2009-09-07t16:49" is a correct invalid datetime-local string.17 PASS "2009-09-07 16:49" is a correct invalid datetime-local string.18 PASS "2009/09/07T16:49" is a correct invalid datetime-local string.19 PASS "a" is a correct invalid datetime-local string.20 PASS "-1-09-07T16:49" is a correct invalid datetime-local string.21 PASS "0000-12-31T23:59:59.999" is a correct invalid datetime-local string.22 PASS "275760-09-13T00:00:00.001" is a correct invalid datetime-local string.23 PASS "invalid" is a correct valid datetime-local string whendisabled.15 PASS " 2009-09-07T16:49 " is an invalid datetime-local string and was sanitized. 16 PASS "2009-09-07t16:49" is an invalid datetime-local string and was sanitized. 17 PASS "2009-09-07 16:49" is an invalid datetime-local string and was sanitized. 18 PASS "2009/09/07T16:49" is an invalid datetime-local string and was sanitized. 19 PASS "a" is an invalid datetime-local string and was sanitized. 20 PASS "-1-09-07T16:49" is an invalid datetime-local string and was sanitized. 21 PASS "0000-12-31T23:59:59.999" is an invalid datetime-local string and was sanitized. 22 PASS "275760-09-13T00:00:00.001" is an invalid datetime-local string and was sanitized. 23 PASS "invalid" is an invalid datetime-local string and was sanitized while disabled. 24 24 PASS successfullyParsed is true 25 25 -
trunk/LayoutTests/fast/forms/datetimelocal/ValidityState-typeMismatch-datetimelocal.html
r98407 r103957 12 12 i.type = 'datetime-local'; 13 13 14 function check(value, mismatchExpected,disabled)14 function check(value, disabled) 15 15 { 16 16 i.value = value; 17 17 i.disabled = !!disabled; 18 var actual = i.validity.typeMismatch; 19 var didPass = actual == mismatchExpected; 20 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' datetime-local string' + (disabled ? ' when disabled.' : '.'); 21 if (didPass) 22 testPassed(resultText); 23 else 24 testFailed(resultText); 18 19 if (i.validity.typeMismatch) 20 testFailed('"' + value + '" had typeMismatch. This should not happen with sanitization.'); 25 21 } 26 22 27 function shouldBeValid(value , disabled)23 function shouldBeValid(value) 28 24 { 29 check(value, false, disabled); 25 check(value); 26 if ((value === '' && i.value === '') || (value !== '' && i.value !== "")) 27 testPassed('"' + value + '" is a correct valid datetime-local string.'); 28 else 29 testFailed('"' + value + '" is a valid datetime-local string that failed to be set on the input.'); 30 30 } 31 31 32 function shouldBeInvalid(value )32 function shouldBeInvalid(value, disabled) 33 33 { 34 check(value, true); 34 check(value, disabled); 35 if (i.value === '') 36 testPassed('"' + value + '" is an invalid datetime-local string and was sanitized' + (disabled ? ' while disabled' : '') + '.'); 37 else 38 testFailed('"' + value + '" is an invalid datetime-local string and was not sanitized' + (disabled ? ' while disabled' : '') + '.'); 35 39 } 36 40 … … 57 61 58 62 // Disabled 59 shouldBe Valid('invalid', true);63 shouldBeInvalid('invalid', true); 60 64 </script> 61 65 <script src="../../js/resources/js-test-post.js"></script> -
trunk/LayoutTests/fast/forms/month/ValidityState-rangeOverflow-month-expected.txt
r92728 r103957 10 10 PASS The value "2010-01" doesn't overflow the maximum value "2010-02". 11 11 PASS The value "2010-01" doesn't overflow the maximum value "2011-01". 12 PASS The value " foo" doesn't overflow the maximum value "2011-01".12 PASS The value "" sanitized from "foo" doesn't overflow the maximum value "2011-01". 13 13 PASS The value "2010-01" doesn't overflow the maximum value "0000-01". 14 14 PASS The value "2010-01" overflows the maximum value "2009-12". -
trunk/LayoutTests/fast/forms/month/ValidityState-rangeOverflow-month.html
r98407 r103957 27 27 } 28 28 29 function checkNotOverflow(value, max, disabled )29 function checkNotOverflow(value, max, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var overflow = input.validity.rangeOverflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (overflow ? 'overflows' : 'doesn\'t overflow') + 37 38 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotOverflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotOverflow(value, max, disabled, true); 42 49 } 43 50 … … 51 58 checkNotOverflow('2010-01', '2010-02'); 52 59 checkNotOverflow('2010-01', '2011-01'); 53 check NotOverflow('foo', '2011-01');60 checkSanitizedValueNotOverflow('foo', '2011-01'); 54 61 checkNotOverflow('2010-01', '0000-01'); // Too small max value. 55 62 -
trunk/LayoutTests/fast/forms/month/ValidityState-rangeUnderflow-month-expected.txt
r92728 r103957 11 11 PASS The value "2010-01" doesn't underflow the minimum value "2009-12". 12 12 PASS The value "2010-01" doesn't underflow the minimum value "2009-01". 13 PASS The value " foo" doesn't underflow the minimum value "2011-01".13 PASS The value "" sanitized from "foo" doesn't underflow the minimum value "2011-01". 14 14 PASS The value "2010-01" undeflows the minimum value "2010-02". 15 15 PASS The value "9999-01" undeflows the minimum value "10000-12". -
trunk/LayoutTests/fast/forms/month/ValidityState-rangeUnderflow-month.html
r98407 r103957 27 27 } 28 28 29 function checkNotUnderflow(value, min, disabled )29 function checkNotUnderflow(value, min, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var underflow = input.validity.rangeUnderflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (underflow ? 'underflows' : 'doesn\'t underflow') + 37 38 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotUnderflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotUnderflow(value, max, disabled, true); 42 49 } 43 50 … … 54 61 checkNotUnderflow('2010-01', '2009-12'); 55 62 checkNotUnderflow('2010-01', '2009-01'); 56 check NotUnderflow('foo', '2011-01');63 checkSanitizedValueNotUnderflow('foo', '2011-01'); 57 64 58 65 // Underflow cases -
trunk/LayoutTests/fast/forms/month/ValidityState-typeMismatch-month-expected.txt
r92728 r103957 20 20 PASS "2009-11" is a correct valid month string. 21 21 PASS "2009-12" is a correct valid month string. 22 PASS " 2009-09 " is a correct invalid month string.23 PASS "a" is a correct invalid month string.24 PASS "-1-09" is a correct invalid month string.25 PASS "0000-12" is a correct invalid month string.26 PASS "2147483648-12" is a correct invalid month string.27 PASS "275760-10" is a correct invalid month string.28 PASS "2009/09" is a correct invalid month string.29 PASS "200909" is a correct invalid month string.30 PASS "2009--2" is a correct invalid month string.31 PASS "2009-00" is a correct invalid month string.32 PASS "2009-13" is a correct invalid month string.33 PASS "2009-" is a correct invalid month string.34 PASS "2009-9" is a correct invalid month string.35 PASS "2009-009" is a correct invalid month string.36 PASS "2009-xx" is a correct invalid month string.37 PASS "2009" is a correct invalid month string.38 PASS "invalid" is a correct valid month string whendisabled.22 PASS " 2009-09 " is an invalid month string and was sanitized. 23 PASS "a" is an invalid month string and was sanitized. 24 PASS "-1-09" is an invalid month string and was sanitized. 25 PASS "0000-12" is an invalid month string and was sanitized. 26 PASS "2147483648-12" is an invalid month string and was sanitized. 27 PASS "275760-10" is an invalid month string and was sanitized. 28 PASS "2009/09" is an invalid month string and was sanitized. 29 PASS "200909" is an invalid month string and was sanitized. 30 PASS "2009--2" is an invalid month string and was sanitized. 31 PASS "2009-00" is an invalid month string and was sanitized. 32 PASS "2009-13" is an invalid month string and was sanitized. 33 PASS "2009-" is an invalid month string and was sanitized. 34 PASS "2009-9" is an invalid month string and was sanitized. 35 PASS "2009-009" is an invalid month string and was sanitized. 36 PASS "2009-xx" is an invalid month string and was sanitized. 37 PASS "2009" is an invalid month string and was sanitized. 38 PASS "invalid" is an invalid month string and was sanitized while disabled. 39 39 PASS successfullyParsed is true 40 40 -
trunk/LayoutTests/fast/forms/month/ValidityState-typeMismatch-month.html
r98407 r103957 12 12 i.type = 'month'; 13 13 14 function check(value, mismatchExpected,disabled)14 function check(value, disabled) 15 15 { 16 16 i.value = value; 17 17 i.disabled = !!disabled; 18 var actual = i.validity.typeMismatch; 19 var didPass = actual == mismatchExpected; 20 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' month string' + (disabled ? ' when disabled.' : '.'); 21 if (didPass) 22 testPassed(resultText); 23 else 24 testFailed(resultText); 18 19 if (i.validity.typeMismatch) 20 testFailed('"' + value + '" had typeMismatch. This should not happen with sanitization.'); 25 21 } 26 22 27 function shouldBeValid(value , disabled)23 function shouldBeValid(value) 28 24 { 29 check(value, false, disabled); 25 check(value); 26 if ((value === '' && i.value === '') || (value !== '' && i.value !== "")) 27 testPassed('"' + value + '" is a correct valid month string.'); 28 else 29 testFailed('"' + value + '" is a valid month string that failed to be set on the input.'); 30 30 } 31 31 32 function shouldBeInvalid(value )32 function shouldBeInvalid(value, disabled) 33 33 { 34 check(value, true); 34 check(value, disabled); 35 if (i.value === '') 36 testPassed('"' + value + '" is an invalid month string and was sanitized' + (disabled ? ' while disabled' : '') + '.'); 37 else 38 testFailed('"' + value + '" is an invalid month string and was not sanitized' + (disabled ? ' while disabled' : '') + '.'); 35 39 } 36 40 … … 72 76 73 77 // Disabled 74 shouldBe Valid('invalid', true);78 shouldBeInvalid('invalid', true); 75 79 </script> 76 80 <script src="../../js/resources/js-test-post.js"></script> -
trunk/LayoutTests/fast/forms/time/ValidityState-rangeOverflow-time-expected.txt
r92746 r103957 10 10 PASS The value "13:16" doesn't overflow the maximum value "13:17". 11 11 PASS The value "13:16" doesn't overflow the maximum value "14:15". 12 PASS The value " foo" doesn't overflow the maximum value "13:16".12 PASS The value "" sanitized from "foo" doesn't overflow the maximum value "13:16". 13 13 PASS The value "13:16" overflows the maximum value "13:15". 14 14 PASS The value "23:59:59.999" overflows the maximum value "13:16". -
trunk/LayoutTests/fast/forms/time/ValidityState-rangeOverflow-time.html
r98407 r103957 27 27 } 28 28 29 function checkNotOverflow(value, max, disabled )29 function checkNotOverflow(value, max, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var overflow = input.validity.rangeOverflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (overflow ? 'overflows' : 'doesn\'t overflow') + 37 38 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotOverflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotOverflow(value, max, disabled, true); 42 49 } 43 50 … … 51 58 checkNotOverflow('13:16', '13:17'); 52 59 checkNotOverflow('13:16', '14:15'); 53 check NotOverflow('foo', '13:16');60 checkSanitizedValueNotOverflow('foo', '13:16'); 54 61 55 62 // Overflow cases -
trunk/LayoutTests/fast/forms/time/ValidityState-rangeUnderflow-time-expected.txt
r92746 r103957 11 11 PASS The value "13:16" doesn't underflow the minimum value "11:00". 12 12 PASS The value "13:16" doesn't underflow the minimum value "13:16". 13 PASS The value " foo" doesn't underflow the minimum value "11:00".13 PASS The value "" sanitized from "foo" doesn't underflow the minimum value "11:00". 14 14 PASS The value "13:16" undeflows the minimum value "13:17". 15 15 PASS The value "23:59" undeflows the minimum value "23:59:30". -
trunk/LayoutTests/fast/forms/time/ValidityState-rangeUnderflow-time.html
r98407 r103957 27 27 } 28 28 29 function checkNotUnderflow(value, min, disabled )29 function checkNotUnderflow(value, min, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var underflow = input.validity.rangeUnderflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (underflow ? 'underflows' : 'doesn\'t underflow') + 37 38 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotUnderflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotUnderflow(value, max, disabled, true); 42 49 } 43 50 … … 52 59 checkNotUnderflow('13:16', '11:00'); 53 60 checkNotUnderflow('13:16', '13:16'); 54 check NotUnderflow('foo', '11:00');61 checkSanitizedValueNotUnderflow('foo', '11:00'); 55 62 56 63 // Underflow cases -
trunk/LayoutTests/fast/forms/time/ValidityState-typeMismatch-time-expected.txt
r92746 r103957 13 13 PASS "23:59:59.1234567890" is a correct valid time string. 14 14 PASS "00:00:00.0000000000" is a correct valid time string. 15 PASS " 00:00 " is a correct invalid time string.16 PASS "1:23" is a correct invalid time string.17 PASS "011:11" is a correct invalid time string.18 PASS "ab:11" is a correct invalid time string.19 PASS "-1:11" is a correct invalid time string.20 PASS "24:11" is a correct invalid time string.21 PASS "11" is a correct invalid time string.22 PASS "11-" is a correct invalid time string.23 PASS "11:-2" is a correct invalid time string.24 PASS "11:60" is a correct invalid time string.25 PASS "11:2b" is a correct invalid time string.26 PASS "11:ab" is a correct invalid time string.27 PASS "11:034" is a correct invalid time string.28 PASS "23:45:" is a correct invalid time string.29 PASS "23:45:6" is a correct invalid time string.30 PASS "23:45:-1" is a correct invalid time string.31 PASS "23:45:70" is a correct invalid time string.32 PASS "23:45:zz" is a correct invalid time string.33 PASS "23:45:06." is a correct invalid time string.34 PASS "23:45:06.abc" is a correct invalid time string.35 PASS "23:45:06.789abc" is a correct invalid time string.36 PASS "invalid" is a correct valid time string whendisabled.15 PASS " 00:00 " is an invalid time string and was sanitized. 16 PASS "1:23" is an invalid time string and was sanitized. 17 PASS "011:11" is an invalid time string and was sanitized. 18 PASS "ab:11" is an invalid time string and was sanitized. 19 PASS "-1:11" is an invalid time string and was sanitized. 20 PASS "24:11" is an invalid time string and was sanitized. 21 PASS "11" is an invalid time string and was sanitized. 22 PASS "11-" is an invalid time string and was sanitized. 23 PASS "11:-2" is an invalid time string and was sanitized. 24 PASS "11:60" is an invalid time string and was sanitized. 25 PASS "11:2b" is an invalid time string and was sanitized. 26 PASS "11:ab" is an invalid time string and was sanitized. 27 PASS "11:034" is an invalid time string and was sanitized. 28 PASS "23:45:" is an invalid time string and was sanitized. 29 PASS "23:45:6" is an invalid time string and was sanitized. 30 PASS "23:45:-1" is an invalid time string and was sanitized. 31 PASS "23:45:70" is an invalid time string and was sanitized. 32 PASS "23:45:zz" is an invalid time string and was sanitized. 33 PASS "23:45:06." is an invalid time string and was sanitized. 34 PASS "23:45:06.abc" is an invalid time string and was sanitized. 35 PASS "23:45:06.789abc" is an invalid time string and was sanitized. 36 PASS "invalid" is an invalid time string and was sanitized while disabled. 37 37 PASS successfullyParsed is true 38 38 -
trunk/LayoutTests/fast/forms/time/ValidityState-typeMismatch-time.html
r98407 r103957 12 12 i.type = 'time'; 13 13 14 function check(value, mismatchExpected,disabled)14 function check(value, disabled) 15 15 { 16 16 i.value = value; 17 17 i.disabled = !!disabled; 18 var actual = i.validity.typeMismatch; 19 var didPass = actual == mismatchExpected; 20 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' time string' + (disabled ? ' when disabled.' : '.'); 21 if (didPass) 22 testPassed(resultText); 23 else 24 testFailed(resultText); 18 19 if (i.validity.typeMismatch) 20 testFailed('"' + value + '" had typeMismatch. This should not happen with sanitization.'); 25 21 } 26 22 27 function shouldBeValid(value , disabled)23 function shouldBeValid(value) 28 24 { 29 check(value, false, disabled); 25 check(value); 26 if ((value === '' && i.value === '') || (value !== '' && i.value !== "")) 27 testPassed('"' + value + '" is a correct valid time string.'); 28 else 29 testFailed('"' + value + '" is a valid time string that failed to be set on the input.'); 30 30 } 31 31 32 function shouldBeInvalid(value )32 function shouldBeInvalid(value, disabled) 33 33 { 34 check(value, true); 34 check(value, disabled); 35 if (i.value === '') 36 testPassed('"' + value + '" is an invalid time string and was sanitized' + (disabled ? ' while disabled' : '') + '.'); 37 else 38 testFailed('"' + value + '" is an invalid time string and was not sanitized' + (disabled ? ' while disabled' : '') + '.'); 35 39 } 36 40 … … 70 74 71 75 // Disabled 72 shouldBe Valid('invalid', true);76 shouldBeInvalid('invalid', true); 73 77 </script> 74 78 <script src="../../js/resources/js-test-post.js"></script> -
trunk/LayoutTests/fast/forms/week/ValidityState-rangeOverflow-week-expected.txt
r92427 r103957 10 10 PASS The value "2010-W01" doesn't overflow the maximum value "2010-W02". 11 11 PASS The value "2010-W01" doesn't overflow the maximum value "2011-W01". 12 PASS The value " foo" doesn't overflow the maximum value "2011-W01".12 PASS The value "" sanitized from "foo" doesn't overflow the maximum value "2011-W01". 13 13 PASS The value "2010-W01" doesn't overflow the maximum value "0000-W01". 14 14 PASS The value "2010-W01" overflows the maximum value "1582-W01". -
trunk/LayoutTests/fast/forms/week/ValidityState-rangeOverflow-week.html
r98407 r103957 27 27 } 28 28 29 function checkNotOverflow(value, max, disabled )29 function checkNotOverflow(value, max, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var overflow = input.validity.rangeOverflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (overflow ? 'overflows' : 'doesn\'t overflow') + 37 38 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotOverflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotOverflow(value, max, disabled, true); 42 49 } 43 50 … … 51 58 checkNotOverflow('2010-W01', '2010-W02'); 52 59 checkNotOverflow('2010-W01', '2011-W01'); 53 check NotOverflow('foo', '2011-W01');60 checkSanitizedValueNotOverflow('foo', '2011-W01'); 54 61 checkNotOverflow('2010-W01', '0000-W01'); // Invalid max value. 55 62 -
trunk/LayoutTests/fast/forms/week/ValidityState-rangeUnderflow-week-expected.txt
r92427 r103957 11 11 PASS The value "2010-W01" doesn't underflow the minimum value "2009-W51". 12 12 PASS The value "2010-W01" doesn't underflow the minimum value "2009-W01". 13 PASS The value " foo" doesn't underflow the minimum value "2011-W01".13 PASS The value "" sanitized from "foo" doesn't underflow the minimum value "2011-W01". 14 14 PASS The value "2010-W01" undeflows the minimum value "2010-W02". 15 15 PASS The value "9999-W01" undeflows the minimum value "10000-W12". -
trunk/LayoutTests/fast/forms/week/ValidityState-rangeUnderflow-week.html
r98407 r103957 27 27 } 28 28 29 function checkNotUnderflow(value, min, disabled )29 function checkNotUnderflow(value, min, disabled, sanitized) 30 30 { 31 31 input.value = value; … … 34 34 var underflow = input.validity.rangeUnderflow; 35 35 var resultText = 'The value "' + input.value + '" ' + 36 (sanitized ? 'sanitized from "' + value + '" ' : '') + 36 37 (underflow ? 'underflows' : 'doesn\'t underflow') + 37 38 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.'); … … 40 41 else 41 42 testPassed(resultText); 43 } 44 45 function checkSanitizedValueNotUnderflow(value, max, disabled) 46 { 47 // For date types, invalid values are sanitized to "". 48 checkNotUnderflow(value, max, disabled, true); 42 49 } 43 50 … … 54 61 checkNotUnderflow('2010-W01', '2009-W51'); 55 62 checkNotUnderflow('2010-W01', '2009-W01'); 56 check NotUnderflow('foo', '2011-W01');63 checkSanitizedValueNotUnderflow('foo', '2011-W01'); 57 64 58 65 // Underflow cases -
trunk/LayoutTests/fast/forms/week/ValidityState-typeMismatch-week-expected.txt
r92427 r103957 13 13 PASS "2003-W52" is a correct valid week string. 14 14 PASS "1992-W53" is a correct valid week string. 15 PASS " 2009-W01 " is a correct invalid week string.16 PASS "2009W01" is a correct invalid week string.17 PASS "2009-w01" is a correct invalid week string.18 PASS "2009-W1" is a correct invalid week string.19 PASS "2009-W001" is a correct invalid week string.20 PASS "a" is a correct invalid week string.21 PASS "-1-W09" is a correct invalid week string.22 PASS "0000-W52" is a correct invalid week string.23 PASS "2147483648-W01" is a correct invalid week string.24 PASS "275760-W38" is a correct invalid week string.25 PASS "2009-W00" is a correct invalid week string.26 PASS "2009-W-1" is a correct invalid week string.27 PASS "2004-W54" is a correct invalid week string.28 PASS "2003-W53" is a correct invalid week string.29 PASS "1992-W54" is a correct invalid week string.30 PASS "2009/09" is a correct invalid week string.31 PASS "200909" is a correct invalid week string.32 PASS "2009-Wxx" is a correct invalid week string.33 PASS "2009" is a correct invalid week string.34 PASS "invalid" is a correct valid week string whendisabled.15 PASS " 2009-W01 " is an invalid week string and was sanitized. 16 PASS "2009W01" is an invalid week string and was sanitized. 17 PASS "2009-w01" is an invalid week string and was sanitized. 18 PASS "2009-W1" is an invalid week string and was sanitized. 19 PASS "2009-W001" is an invalid week string and was sanitized. 20 PASS "a" is an invalid week string and was sanitized. 21 PASS "-1-W09" is an invalid week string and was sanitized. 22 PASS "0000-W52" is an invalid week string and was sanitized. 23 PASS "2147483648-W01" is an invalid week string and was sanitized. 24 PASS "275760-W38" is an invalid week string and was sanitized. 25 PASS "2009-W00" is an invalid week string and was sanitized. 26 PASS "2009-W-1" is an invalid week string and was sanitized. 27 PASS "2004-W54" is an invalid week string and was sanitized. 28 PASS "2003-W53" is an invalid week string and was sanitized. 29 PASS "1992-W54" is an invalid week string and was sanitized. 30 PASS "2009/09" is an invalid week string and was sanitized. 31 PASS "200909" is an invalid week string and was sanitized. 32 PASS "2009-Wxx" is an invalid week string and was sanitized. 33 PASS "2009" is an invalid week string and was sanitized. 34 PASS "invalid" is an invalid week string and was sanitized while disabled. 35 35 PASS successfullyParsed is true 36 36 -
trunk/LayoutTests/fast/forms/week/ValidityState-typeMismatch-week.html
r98407 r103957 12 12 i.type = 'week'; 13 13 14 function check(value, mismatchExpected,disabled)14 function check(value, disabled) 15 15 { 16 16 i.value = value; 17 17 i.disabled = !!disabled; 18 var actual = i.validity.typeMismatch; 19 var didPass = actual == mismatchExpected; 20 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' week string' + (disabled ? ' when disabled.' : '.'); 21 if (didPass) 22 testPassed(resultText); 23 else 24 testFailed(resultText); 18 19 if (i.validity.typeMismatch) 20 testFailed('"' + value + '" had typeMismatch. This should not happen with sanitization.'); 25 21 } 26 22 27 function shouldBeValid(value , disabled)23 function shouldBeValid(value) 28 24 { 29 check(value, false, disabled); 25 check(value); 26 if ((value === '' && i.value === '') || (value !== '' && i.value !== "")) 27 testPassed('"' + value + '" is a correct valid week string.'); 28 else 29 testFailed('"' + value + '" is a valid week string that failed to be set on the input.'); 30 30 } 31 31 32 function shouldBeInvalid(value )32 function shouldBeInvalid(value, disabled) 33 33 { 34 check(value, true); 34 check(value, disabled); 35 if (i.value === '') 36 testPassed('"' + value + '" is an invalid week string and was sanitized' + (disabled ? ' while disabled' : '') + '.'); 37 else 38 testFailed('"' + value + '" is an invalid week string and was not sanitized' + (disabled ? ' while disabled' : '') + '.'); 35 39 } 36 40 … … 68 72 69 73 // Disabled 70 shouldBe Valid('invalid', true);74 shouldBeInvalid('invalid', true); 71 75 </script> 72 76 <script src="../../../fast/js/resources/js-test-post.js"></script> -
trunk/Source/WebCore/ChangeLog
r103955 r103957 1 2011-12-22 Joseph Pecoraro <pecoraro@apple.com> 2 3 Implement Date and Time Input Value Sanitization 4 https://bugs.webkit.org/show_bug.cgi?id=59951 5 6 Sanitize non-parsable incoming strings to the empty string. 7 8 Reviewed by Kent Tamura. 9 10 Covered by existing tests. 11 12 * html/BaseDateAndTimeInputType.h: 13 * html/BaseDateAndTimeInputType.cpp: 14 (WebCore::BaseDateAndTimeInputType::sanitizeValue): check if the 15 incoming string is valid. If not just return the empty string. 16 1 17 2012-01-03 Julien Chaffraix <jchaffraix@webkit.org> 2 18 -
trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp
r95901 r103957 213 213 } 214 214 215 String BaseDateAndTimeInputType::sanitizeValue(const String& proposedValue) const 216 { 217 return typeMismatchFor(proposedValue) ? String() : proposedValue; 218 } 219 215 220 } // namespace WebCore -
trunk/Source/WebCore/html/BaseDateAndTimeInputType.h
r103400 r103957 69 69 virtual String visibleValue() const OVERRIDE; 70 70 virtual String convertFromVisibleValue(const String&) const OVERRIDE; 71 virtual String sanitizeValue(const String&) const OVERRIDE; 71 72 }; 72 73
Note: See TracChangeset
for help on using the changeset viewer.