gerrit/gerrit-gwtui-common
Edwin Kempin c8f311b9f9 RemoteSuggestOracle: Fix JavaScript TypeError
If Gerrit is configured to show suggestions only after typing n
characters (see gerrit config parameter suggest.from) typing
characters in the suggest box causes a JavaScript TypeError while n
characters are not reached yet:

Caused by: Class$S146: (TypeError) : Cannot read property 'start_5' of undefined
	at Unknown.onSuggestionsReady_2(gerrit_ui-0.js)
	at Unknown.onSuggestionsReady_4(gerrit_ui-0.js)
	at Unknown.onRequestSuggestions_0(gerrit_ui-0.js)
	at Unknown.requestSuggestions(gerrit_ui-0.js)
	at Unknown.start_5(gerrit_ui-0.js)
	at Unknown.requestSuggestions_0(gerrit_ui-0.js)
	at Unknown.showSuggestions_0(gerrit_ui-0.js)
	at Unknown.refreshSuggestions(gerrit_ui-0.js)
	at Unknown.onKeyUp_5(gerrit_ui-0.js)
        ...

This is because the query is started before assigning it to the
'query' variable, which the callback expects to be non-null. If n
characters are not typed yet, there is no remote call and the callback
is immediately invoked with empty results as soon as the query is
started. This means the 'query' variable is still not set and this
results in the TypeError as shown above. If a remote call was done to
get the suggestions, there was no problem, because then the callback
was always invoked after the 'query' variable has been assigned.

Change-Id: Ia41102a8cc87237b9e7ed728259daf2b6b86996c
Signed-off-by: Edwin Kempin <ekempin@google.com>
2016-06-23 10:54:25 +00:00
..
src RemoteSuggestOracle: Fix JavaScript TypeError 2016-06-23 10:54:25 +00:00
BUCK Buck: Upgrade to the latest version 2015-11-03 06:36:13 +01:00