Bug 1306639 - Searching in locationbar by typing something and pressing enter is not accounted in telemetry. r=adw

MozReview-Commit-ID: 9r8IyyyxruC
This commit is contained in:
Marco Bonardo
2016-10-06 17:40:13 +02:00
parent d09e46ab3d
commit 9f5dc75ac5
9 changed files with 260 additions and 141 deletions

View File

@@ -89,6 +89,26 @@ nsAutoCompleteController::GetInput(nsIAutoCompleteInput **aInput)
return NS_OK;
}
NS_IMETHODIMP
nsAutoCompleteController::SetInitiallySelectedIndex(int32_t aSelectedIndex)
{
// First forward to the popup.
nsCOMPtr<nsIAutoCompleteInput> input(mInput);
NS_ENSURE_STATE(input);
nsCOMPtr<nsIAutoCompletePopup> popup;
input->GetPopup(getter_AddRefs(popup));
NS_ENSURE_STATE(popup);
popup->SetSelectedIndex(aSelectedIndex);
// Now take care of internal stuff.
bool completeSelection;
if (NS_SUCCEEDED(input->GetCompleteSelectedIndex(&completeSelection)) &&
completeSelection) {
mCompletedSelectionIndex = aSelectedIndex;
}
return NS_OK;
}
NS_IMETHODIMP
nsAutoCompleteController::SetInput(nsIAutoCompleteInput *aInput)
{
@@ -1425,9 +1445,7 @@ nsAutoCompleteController::EnterMatch(bool aIsPopupSelection,
// differs from the user-facing value.
nsAutoString finalValue;
GetResultValueAt(mCompletedSelectionIndex, true, finalValue);
nsAutoString completedValue;
GetResultValueAt(mCompletedSelectionIndex, false, completedValue);
if (completedValue.Equals(inputValue) && !finalValue.Equals(inputValue)) {
if (!inputValue.Equals(finalValue)) {
value = finalValue;
}
// Note that if the user opens the popup, mouses over entries without