mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Restrict HTMLInputElement::min_length
to the range of i32
This commit is contained in:
parent
40d6b9d44e
commit
bc484258c2
Notes:
github-actions[bot]
2024-12-02 09:27:00 +00:00
Author: https://github.com/tcl3
Commit: bc484258c2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2685
3 changed files with 20 additions and 1 deletions
|
@ -1849,7 +1849,7 @@ WebIDL::Long HTMLInputElement::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;
|
||||
|
|
|
@ -116,6 +116,24 @@ input.maxLength = 2147483648 threw exception of type IndexSizeError
|
|||
input.getAttribute("maxlength") after input.setAttribute("maxLength", "4294967295"): 4294967295
|
||||
input.maxLength after input.setAttribute("maxlength", "4294967295"): -1
|
||||
input.maxLength = 4294967295 threw exception of type IndexSizeError
|
||||
input.getAttribute("minlength") after input.setAttribute("minLength", "0"): 0
|
||||
input.minLength after input.setAttribute("minlength", "0"): 0
|
||||
input.getAttribute("minlength") after input.minLength = 0: 0
|
||||
input.minLength after input.minLength = 0: 0
|
||||
input.getAttribute("minlength") after input.setAttribute("minLength", "1"): 1
|
||||
input.minLength after input.setAttribute("minlength", "1"): 1
|
||||
input.getAttribute("minlength") after input.minLength = 1: 1
|
||||
input.minLength after input.minLength = 1: 1
|
||||
input.getAttribute("minlength") after input.setAttribute("minLength", "2147483647"): 2147483647
|
||||
input.minLength after input.setAttribute("minlength", "2147483647"): 2147483647
|
||||
input.getAttribute("minlength") after input.minLength = 2147483647: 2147483647
|
||||
input.minLength after input.minLength = 2147483647: 2147483647
|
||||
input.getAttribute("minlength") after input.setAttribute("minLength", "2147483648"): 2147483648
|
||||
input.minLength after input.setAttribute("minlength", "2147483648"): -1
|
||||
input.minLength = 2147483648 threw exception of type IndexSizeError
|
||||
input.getAttribute("minlength") after input.setAttribute("minLength", "4294967295"): 4294967295
|
||||
input.minLength after input.setAttribute("minlength", "4294967295"): -1
|
||||
input.minLength = 4294967295 threw exception of type IndexSizeError
|
||||
input.getAttribute("size") after input.setAttribute("size", "0"): 0
|
||||
input.size after input.setAttribute("size", "0"): 20
|
||||
input.size = 0 threw exception of type IndexSizeError
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
testProperty("img", "hspace", (img) => img.hspace, (img, value) => img.hspace = value);
|
||||
testProperty("img", "width", (img) => img.width, (img, value) => img.width = value);
|
||||
testProperty("input", "maxLength", (input) => input.maxLength, (input, value) => input.maxLength = value);
|
||||
testProperty("input", "minLength", (input) => input.minLength, (input, value) => input.minLength = value);
|
||||
testProperty("input", "size", (input) => input.size, (input, value) => input.size = value);
|
||||
testProperty(imageButtonInputFactory, "height", (input) => input.height, (input, value) => input.height = value);
|
||||
testProperty(imageButtonInputFactory, "width", (input) => input.width, (input, value) => input.width = value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue