From 103aa8108571292b70bd949119d8e214efca3d0e Mon Sep 17 00:00:00 2001 From: Blake Winton Date: Mon, 8 Sep 2014 11:13:30 -0400 Subject: [PATCH] Bug 1036912 - Log selections of searchSuggestTable in newtab. r=mak --- browser/base/content/newtab/search.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/browser/base/content/newtab/search.js b/browser/base/content/newtab/search.js index 5038b633009c..405981402691 100644 --- a/browser/base/content/newtab/search.js +++ b/browser/base/content/newtab/search.js @@ -33,13 +33,24 @@ let gSearch = { if (event) { event.preventDefault(); } - let searchStr = this._nodes.text.value; + let searchText = this._nodes.text; + let searchStr = searchText.value; if (this.currentEngineName && searchStr.length) { - this._send("Search", { + + let eventData = { engineName: this.currentEngineName, searchString: searchStr, whence: "newtab", - }); + } + + if (searchText.hasAttribute("selection-index")) { + eventData.selection = { + index: searchText.getAttribute("selection-index"), + kind: searchText.getAttribute("selection-kind") + }; + } + + this._send("Search", eventData); } this._suggestionController.addInputValueToFormHistory(); },