Bug 1120957 - fix the source of searches made with paste & search, r=gijs,bwinton

This commit is contained in:
Vikram Jadhav 2015-03-09 12:07:00 +01:00
parent 0ad5ebd649
commit d1bddf61a3
2 changed files with 12 additions and 2 deletions

View File

@ -3490,6 +3490,12 @@ const BrowserSearch = {
}
},
pasteAndSearch: function (event) {
BrowserSearch.searchBar.select();
goDoCommand("cmd_paste");
BrowserSearch.searchBar.handleSearchCommand(event);
},
/**
* Returns the search bar element if it is present in the toolbar, null otherwise.
*/

View File

@ -521,6 +521,11 @@
target.parentNode.classList.contains("search-panel-header")) {
source = "header";
}
} else if (aEvent instanceof XULCommandEvent) {
if (target.getAttribute("anonid") == "paste-and-search") {
aEngine = this.currentEngine;
source = "paste";
}
}
BrowserSearch.recordOneoffSearchInTelemetry(aEngine, source, type, where);
@ -837,8 +842,7 @@
label = this._stringBundle.getString("cmd_pasteAndSearch");
element.setAttribute("label", label);
element.setAttribute("anonid", "paste-and-search");
element.setAttribute("oncommand",
"BrowserSearch.searchBar.select(); goDoCommand('cmd_paste'); BrowserSearch.searchBar.handleSearchCommand();");
element.setAttribute("oncommand", "BrowserSearch.pasteAndSearch(event)");
cxmenu.insertBefore(element, insertLocation.nextSibling);
pasteAndSearch = element;
}