mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 17:24:48 -05:00
LibWeb: Restrict HTMLTextAreaElement::min_length
to the range of i32
This commit is contained in:
parent
ac7fad52f6
commit
7097152ebc
Notes:
github-actions[bot]
2024-12-02 09:26:49 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/7097152ebc9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2685
3 changed files with 21 additions and 2 deletions
|
@ -276,7 +276,7 @@ WebIDL::Long HTMLTextAreaElement::min_length() const
|
|||
{
|
||||
// The minLength IDL attribute must reflect the minlength content attribute, limited to only non-negative numbers.
|
||||
if (auto minlength_string = get_attribute(HTML::AttributeNames::minlength); minlength_string.has_value()) {
|
||||
if (auto minlength = parse_non_negative_integer(*minlength_string); minlength.has_value())
|
||||
if (auto minlength = parse_non_negative_integer(*minlength_string); minlength.has_value() && *minlength <= 2147483647)
|
||||
return *minlength;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -253,6 +253,24 @@ select.getAttribute("size") after select.setAttribute("size", "4294967295"): 429
|
|||
select.size after select.setAttribute("size", "4294967295"): 0
|
||||
select.getAttribute("size") after select.size = 4294967295: 0
|
||||
select.size after select.size = 4294967295: 0
|
||||
textarea.getAttribute("maxlength") after textarea.setAttribute("maxLength", "0"): 0
|
||||
textarea.maxLength after textarea.setAttribute("maxlength", "0"): 0
|
||||
textarea.getAttribute("maxlength") after textarea.maxLength = 0: 0
|
||||
textarea.maxLength after textarea.maxLength = 0: 0
|
||||
textarea.getAttribute("maxlength") after textarea.setAttribute("maxLength", "1"): 1
|
||||
textarea.maxLength after textarea.setAttribute("maxlength", "1"): 1
|
||||
textarea.getAttribute("maxlength") after textarea.maxLength = 1: 1
|
||||
textarea.maxLength after textarea.maxLength = 1: 1
|
||||
textarea.getAttribute("maxlength") after textarea.setAttribute("maxLength", "2147483647"): 2147483647
|
||||
textarea.maxLength after textarea.setAttribute("maxlength", "2147483647"): 2147483647
|
||||
textarea.getAttribute("maxlength") after textarea.maxLength = 2147483647: 2147483647
|
||||
textarea.maxLength after textarea.maxLength = 2147483647: 2147483647
|
||||
textarea.getAttribute("maxlength") after textarea.setAttribute("maxLength", "2147483648"): 2147483648
|
||||
textarea.maxLength after textarea.setAttribute("maxlength", "2147483648"): -1
|
||||
textarea.maxLength = 2147483648 threw exception of type IndexSizeError
|
||||
textarea.getAttribute("maxlength") after textarea.setAttribute("maxLength", "4294967295"): 4294967295
|
||||
textarea.maxLength after textarea.setAttribute("maxlength", "4294967295"): -1
|
||||
textarea.maxLength = 4294967295 threw exception of type IndexSizeError
|
||||
textarea.getAttribute("minlength") after textarea.setAttribute("minLength", "0"): 0
|
||||
textarea.minLength after textarea.setAttribute("minlength", "0"): 0
|
||||
textarea.getAttribute("minlength") after textarea.minLength = 0: 0
|
||||
|
@ -266,7 +284,7 @@ textarea.minLength after textarea.setAttribute("minlength", "2147483647"): 21474
|
|||
textarea.getAttribute("minlength") after textarea.minLength = 2147483647: 2147483647
|
||||
textarea.minLength after textarea.minLength = 2147483647: 2147483647
|
||||
textarea.getAttribute("minlength") after textarea.setAttribute("minLength", "2147483648"): 2147483648
|
||||
textarea.minLength after textarea.setAttribute("minlength", "2147483648"): -2147483648
|
||||
textarea.minLength after textarea.setAttribute("minlength", "2147483648"): -1
|
||||
textarea.minLength = 2147483648 threw exception of type IndexSizeError
|
||||
textarea.getAttribute("minlength") after textarea.setAttribute("minLength", "4294967295"): 4294967295
|
||||
textarea.minLength after textarea.setAttribute("minlength", "4294967295"): -1
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
testProperty("marquee", "scrollAmount", (marquee) => marquee.scrollAmount, (marquee, value) => marquee.scrollAmount = value);
|
||||
testProperty("marquee", "scrollDelay", (marquee) => marquee.scrollDelay, (marquee, value) => marquee.scrollDelay = value);
|
||||
testProperty("select", "size", (select) => select.size, (select, value) => select.size = value);
|
||||
testProperty("textarea", "maxLength", (textarea) => textarea.maxLength, (textarea, value) => textarea.maxLength = value);
|
||||
testProperty("textarea", "minLength", (textarea) => textarea.minLength, (textarea, value) => textarea.minLength = value);
|
||||
testProperty("textarea", "rows", (textarea) => textarea.rows, (textarea, value) => textarea.rows = value);
|
||||
testProperty("textarea", "cols", (textarea) => textarea.cols, (textarea, value) => textarea.cols = value);
|
||||
|
|
Loading…
Reference in a new issue