зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1682264 - Simplify the search bar selected index telemetry reporting. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D99669
This commit is contained in:
Родитель
fdc070b1fb
Коммит
2493b6432d
|
@ -161,10 +161,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
this.searchbar.telemetrySearchDetails = {
|
||||
index: this.selectedIndex,
|
||||
kind: "mouse",
|
||||
};
|
||||
this.searchbar.telemetrySelectedIndex = this.selectedIndex;
|
||||
|
||||
// Check for unmodified left-click, and use default behavior
|
||||
if (
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
|
||||
this._ignoreFocus = false;
|
||||
this._engines = null;
|
||||
this.telemetrySelectedIndex = -1;
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
|
@ -345,16 +346,16 @@
|
|||
let textBox = this._textbox;
|
||||
let textValue = textBox.value;
|
||||
|
||||
let selection = this.telemetrySearchDetails;
|
||||
let selectedIndex = this.telemetrySelectedIndex;
|
||||
let oneOffRecorded = false;
|
||||
|
||||
BrowserSearchTelemetry.recordSearchSuggestionSelectionMethod(
|
||||
aEvent,
|
||||
"searchbar",
|
||||
selection ? selection.index : -1
|
||||
selectedIndex
|
||||
);
|
||||
|
||||
if (!selection || selection.index == -1) {
|
||||
if (selectedIndex == -1) {
|
||||
oneOffRecorded = this.textbox.popup.oneOffButtons.maybeRecordTelemetry(
|
||||
aEvent
|
||||
);
|
||||
|
@ -431,18 +432,16 @@
|
|||
}
|
||||
|
||||
let submission = engine.getSubmission(aData, null, "searchbar");
|
||||
let telemetrySearchDetails = this.telemetrySearchDetails;
|
||||
this.telemetrySearchDetails = null;
|
||||
if (telemetrySearchDetails && telemetrySearchDetails.index == -1) {
|
||||
telemetrySearchDetails = null;
|
||||
}
|
||||
|
||||
// If we hit here, we come either from a one-off, a plain search or a suggestion.
|
||||
const details = {
|
||||
isOneOff: aOneOff,
|
||||
isSuggestion: !aOneOff && telemetrySearchDetails,
|
||||
selection: telemetrySearchDetails,
|
||||
isSuggestion: !aOneOff && this.telemetrySelectedIndex != -1,
|
||||
url: submission.uri,
|
||||
};
|
||||
|
||||
this.telemetrySelectedIndex = -1;
|
||||
|
||||
BrowserSearchTelemetry.recordSearch(
|
||||
gBrowser,
|
||||
engine,
|
||||
|
@ -814,9 +813,9 @@
|
|||
}
|
||||
engine = oneOff.engine;
|
||||
}
|
||||
if (this.textbox._selectionDetails) {
|
||||
BrowserSearch.searchBar.telemetrySearchDetails = this.textbox._selectionDetails;
|
||||
this.textbox._selectionDetails = null;
|
||||
if (this.textbox.popupSelectedIndex != -1) {
|
||||
this.telemetrySelectedIndex = this.textbox.popupSelectedIndex;
|
||||
this.textbox.popupSelectedIndex = -1;
|
||||
}
|
||||
this.handleSearchCommand(event, engine);
|
||||
};
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.popupSelectedIndex = -1;
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"PrivateBrowsingUtils",
|
||||
|
@ -118,8 +120,6 @@
|
|||
);
|
||||
|
||||
this.valueIsTyped = false;
|
||||
|
||||
this._selectionDetails = null;
|
||||
}
|
||||
|
||||
get popup() {
|
||||
|
@ -560,10 +560,7 @@
|
|||
}
|
||||
}
|
||||
if (this.popup.selectedIndex >= 0) {
|
||||
this._selectionDetails = {
|
||||
index: this.popup.selectedIndex,
|
||||
kind: "key",
|
||||
};
|
||||
this.popupSelectedIndex = this.popup.selectedIndex;
|
||||
}
|
||||
cancel = this.handleEnter(aEvent);
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче