Bug 1257087 - Middle mouse click on history item should open it. r=mak

This commit is contained in:
Dão Gottwald 2016-05-25 18:15:15 +02:00
Родитель 8cb678bf6b
Коммит f0ad31722f
2 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -1452,12 +1452,6 @@ var BookmarkingUI = {
options.maxResults = kMaxResults;
let query = PlacesUtils.history.getNewQuery();
let onItemCommand = function (aEvent) {
let item = aEvent.target;
openUILink(item.getAttribute("targetURI"), aEvent);
CustomizableUI.hidePanelForNode(item);
};
let fragment = document.createDocumentFragment();
let root = PlacesUtils.history.executeQuery(query, options).root;
root.containerOpen = true;
@ -1475,7 +1469,6 @@ var BookmarkingUI = {
item.setAttribute("simulated-places-node", true);
item.setAttribute("class", "menuitem-iconic menuitem-with-favicon bookmark-item " +
aExtraCSSClass);
item.addEventListener("command", onItemCommand);
if (icon) {
item.setAttribute("image", icon);
}

Просмотреть файл

@ -206,6 +206,11 @@ const CustomizableWidgets = [
.asyncExecuteLegacyQueries([query], 1, options, {
handleResult: function (aResultSet) {
let onItemCommand = function (aEvent) {
// Only handle the click event for middle clicks, we're using the command
// event otherwise.
if (aEvent.type == "click" && aEvent.button != 1) {
return;
}
let item = aEvent.target;
win.openUILink(item.getAttribute("targetURI"), aEvent);
CustomizableUI.hidePanelForNode(item);
@ -222,6 +227,7 @@ const CustomizableWidgets = [
item.setAttribute("targetURI", uri);
item.setAttribute("class", "subviewbutton");
item.addEventListener("command", onItemCommand);
item.addEventListener("click", onItemCommand);
if (icon) {
let iconURL = "moz-anno:favicon:" + icon;
item.setAttribute("image", iconURL);