Closed
Bug 720598
Opened 13 years ago
Closed 13 years ago
nsAutocompleteController HandleKeyNavigation() and EnterMatch() call GetDefaultCompleteValue() with a bogus aResultIndex
Categories
(Toolkit :: Autocomplete, defect)
Toolkit
Autocomplete
Tracking
()
RESOLVED
FIXED
mozilla12
People
(Reporter: Gavin, Assigned: mak)
Details
Attachments
(1 file)
(deleted),
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
GetDefaultCompleteValue()'s aResultIndex argument is supposed to be the index of the result to use within mResults.
HandleKeyNavigation() and EnterMatch() both try to check the default complete value in order to restore the proper case after an item is deemed to have been "selected" (by pressing a right/left arrow, or by pressing enter). However, they do this by passing in popup's selected index as aResultIndex, which is not at all related to nsIAutocompleteResults. The result is that GetDefaultCompleteValue() in these cases will fail unless you happen to have the right item selected in the popup (usually the first or second), in which case the callers just do nothing.
To do this properly, I guess it would need to use RowIndexToSearch() to convert the popup selectedIndex into an index into mResults.
Assignee | ||
Comment 2•13 years ago
|
||
In the end this was just confusing code, selectedIndex is likely always -1 there, since otherwise we'd take the other path in the if condition.
So this hardcodes -1 and adds a generic test for completeDefaultIndex, not incredibly useful but more testing > less testing.
Attachment #591566 -
Flags: review?(gavin.sharp)
Reporter | ||
Comment 3•13 years ago
|
||
Comment on attachment 591566 [details] [diff] [review]
patch v1.0
thanks!
Attachment #591566 -
Flags: review?(gavin.sharp) → review+
Assignee | ||
Comment 4•13 years ago
|
||
Flags: in-testsuite+
Target Milestone: --- → mozilla12
Comment 5•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•