Commit 4fb87ca3 authored by staikos's avatar staikos

Fix mod-by-zero crash when typeahead is triggered on an empty select.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@23523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 21368dd4
2007-06-14 George Staikos <staikos@kde.org>
Reviewed by Maciej.
Test for keypress causing typeahead crash on empty selects (% 0)
* fast/forms/listbox-typeahead-empty-expected.txt: Added.
* fast/forms/listbox-typeahead-empty.html: Added.
2007-06-13 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
Selection box crashes on search when it's empty.
Cannot run interactively.
<p>
Selection box crashes on search when it's empty.
</p>
<select id="list">
</select>
<div id="result">Cannot run interactively.</div>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
var list = document.getElementById("list");
list.focus();
eventSender.keyDown("z");
eventSender.keyDown("z");
eventSender.keyDown("z");
eventSender.keyDown("z");
eventSender.keyDown("z");
eventSender.keyDown("z");
}
</script>
2007-06-14 George Staikos <staikos@kde.org>
Reviewed by Maciej.
Keypress causes typeahead crash on empty selects due to modulo 0.
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::typeAheadFind):
2007-06-13 George Staikos <staikos@kde.org>
Reviewed by Lars.
......@@ -946,6 +946,8 @@ void HTMLSelectElement::typeAheadFind(KeyboardEvent* event)
const Vector<HTMLElement*>& items = listItems();
int itemCount = items.size();
if (itemCount < 1)
return;
int index = (optionToListIndex(selectedIndex()) + searchStartOffset) % itemCount;
for (int i = 0; i < itemCount; i++, index = (index + 1) % itemCount) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment