forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore 100,000 limit in HTMLOptionsCollection.length setter
https://bugs.webkit.org/show_bug.cgi?id=252983 Reviewed by Chris Dumez. This patch is to align WebKit with Blink / Chromium and Gecko / Firefox. Merge - https://chromium.googlesource.com/chromium/src/+/f27e6ea87ecf211c8b8644813422a9e7f19cd1cc This patch updates 'maxSelectItems' to new value of 100,000 to reflect update in spec. Further, it is updated to be only used when new length is greater than current length. Additionally, add comments to reflect the details as needed. Web-Spec: https://html.spec.whatwg.org/#dom-htmloptionscollection-length Issue: whatwg/html#8337 * Source/WebCore/html/HTMLSelectElement.cpp: (maxSelectItems): Update constant value (HTMLSelectElement::setItem): Remove '=' and update comments and console message (HTMLSelectElement::setLength): Add comment and update console message * LayoutTests/imported/w3c/web-platform-tests/html/select/options-length-too-large.html: Add Test Case * LayoutTests/imported/w3c/web-platform-tests/html/select/options-length-too-large-expected.txt: Add Test Case Expectation * LayoutTests/fast/forms/select-max-length-expected.txt: Rebaselined * LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-multiple-expected.txt: Rebaselined * LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-expected.txt: Rebaselined Canonical link: https://commits.webkit.org/260896@main
- Loading branch information
1 parent
75ee907
commit a27ac64
Showing
6 changed files
with
73 additions
and
10 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-multiple-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...utTests/imported/w3c/web-platform-tests/html/select/options-length-too-large-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CONSOLE MESSAGE: Unable to expand the option list to length 4294967295 items. The maximum number of items allowed is 100000. | ||
CONSOLE MESSAGE: Unable to expand the option list to length 100001 items. The maximum number of items allowed is 100000. | ||
CONSOLE MESSAGE: Unable to expand the option list to length 4294967295 items. The maximum number of items allowed is 100000. | ||
|
||
|
||
PASS select options.length too large | ||
PASS select options.length too large 1 | ||
PASS select options.length too large 2 | ||
PASS select options.length too large 3 | ||
PASS select options.length too large 4 | ||
|
50 changes: 50 additions & 0 deletions
50
LayoutTests/imported/w3c/web-platform-tests/html/select/options-length-too-large.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="timeout" content="long"> | ||
<title>select options.length too large</title> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<select id="test"> | ||
<option value="1"></option> | ||
<option value="2"></option> | ||
<option value="3"></option> | ||
</select> | ||
|
||
<script> | ||
var mySelect = document.getElementById("test"); | ||
|
||
test(function() { | ||
mySelect.options.length = -1; | ||
assert_equals(mySelect.options.length, 3, "Length of <select> should remain unchanged"); | ||
}); | ||
|
||
test(function() { | ||
mySelect.options.length = 100001; | ||
assert_equals(mySelect.options.length, 3, "Length of <select> should remain unchanged"); | ||
}); | ||
|
||
test(function() { | ||
mySelect.options.length = Number.MAX_SAFE_INTEGER; | ||
assert_equals(mySelect.options.length, 3, "Length of <select> should remain unchanged"); | ||
}); | ||
|
||
test(function() { | ||
mySelect.options.length = 100000; | ||
assert_equals(mySelect.options.length, 100000, "Length of <select> should be 100,000"); | ||
}); | ||
|
||
test(function() { | ||
mySelect.appendChild(new Option()); | ||
mySelect.appendChild(new Option()); | ||
assert_equals(mySelect.options.length, 100002, "Manual expansion still works"); | ||
mySelect.options.length = 100001; | ||
assert_equals(mySelect.options.length, 100001, "Truncation works if over the limit"); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters