Bug 1124238 - The autofill placeholder should not override keywords. r=mak

MozReview-Commit-ID: D6gBdkQxMrW
This commit is contained in:
Julian Viereck
2018-05-30 16:50:37 +02:00
parent 2675982a0f
commit b14ee48f19
3 changed files with 65 additions and 12 deletions

View File

@@ -1529,8 +1529,20 @@ nsAutoCompleteController::CompleteDefaultIndex(int32_t aResultIndex)
nsAutoString resultValue;
if (NS_SUCCEEDED(GetDefaultCompleteValue(aResultIndex, true, resultValue))) {
CompleteValue(resultValue);
mDefaultIndexCompleted = true;
} else {
// Reset the search string again, in case it was completed with
// mPlaceholderCompletionString, but the actually received result doesn't
// have a default index result. Only reset the input when necessary, to
// avoid triggering unnecessary new searches.
nsAutoString inputValue;
input->GetTextValue(inputValue);
if (!inputValue.Equals(mSearchString)) {
SetValueOfInputTo(mSearchString,
nsIAutoCompleteInput::TEXTVALUE_REASON_REVERT);
input->SelectTextRange(mSearchString.Length(), mSearchString.Length());
}
mPlaceholderCompletionString.Truncate();
}
return NS_OK;