gecko-dev/toolkit/components/autocomplete
Masayuki Nakano 169354c54c Bug 1407085 - nsAutoCompleteController shouldn't restore original value after somebody changes the input value even when Escape key is pressed r=mak
When Escape key is pressed, nsAutoCompleteController needs to restore last
string which was default value of the input or typed by the user.  However,
somebody may change the value, e.g., an event listener which handles
Escape key.  In this case, nsAutoCompleteController shouldn't restore the
last string.

Unfortunately, when JS sets input value, DOM "input" event won't be fired.
Therefore, nsAutoCompleteController doesn't have a chance to modify
mSearchString in this case.  Therefore, nsAutoCompleteController needs to
store expected input string for checking if somebody modified the input value.
For solving this issue, this patch adds a new member, mSetValue which is
modified when the input value is modified by nsAutoCompleteController itself
or mSearchString is modified.

Even with this patch, if user temporarily selects an item of the popup and
JS sets same value as the selected item from JS, nsAutoCompleteController
restores the input value with mSearchString.  However, this must be rare
case and I don't have idea to fix this issue with simple patches.

MozReview-Commit-ID: lig8c7xvD7

--HG--
extra : rebase_source : 787dbfb35bc70d27fb09ec93861164e7a5165be3
2017-12-19 16:46:20 +09:00
..
tests/unit Bug 1421992 - script-generated patch to replace do_execute_soon, do_print and do_register_cleanup with executeSoon, info and registerCleanupFunction, rs=Gijs. 2017-12-21 11:10:23 +01:00
moz.build
nsAutoCompleteController.cpp Bug 1407085 - nsAutoCompleteController shouldn't restore original value after somebody changes the input value even when Escape key is pressed r=mak 2017-12-19 16:46:20 +09:00
nsAutoCompleteController.h Bug 1407085 - nsAutoCompleteController shouldn't restore original value after somebody changes the input value even when Escape key is pressed r=mak 2017-12-19 16:46:20 +09:00
nsAutoCompleteSimpleResult.cpp Bug 1391293 - Reduce Address Bar results flickering when typing additional chars. r=adw 2017-09-08 11:39:44 +02:00
nsAutoCompleteSimpleResult.h
nsIAutoCompleteController.idl Bug 1370518 - Don't completely detach/attach the autocomplete controller on TabSelect. r=mconley 2017-06-06 18:47:19 +02:00
nsIAutoCompleteInput.idl
nsIAutoCompletePopup.idl
nsIAutoCompleteResult.idl
nsIAutoCompleteSearch.idl Bug 1415908 - Intermittent failure (nsIAutoCompleteController.getCommentAt) in browser_ext_omnibox.js. r=adw 2017-11-19 21:58:14 +01:00
nsIAutoCompleteSimpleResult.idl Bug 1391293 - Reduce Address Bar results flickering when typing additional chars. r=adw 2017-09-08 11:39:44 +02:00