From b9d8f2d3719d702ac3870bf2241a719fbbe6d992 Mon Sep 17 00:00:00 2001 From: Kit Cambridge Date: Tue, 5 Apr 2016 17:06:00 -0700 Subject: [PATCH] Bug 1262310 - Fix opening synced tabs from the sidebar. r=markh MozReview-Commit-ID: 8VHbEqsyuF2 --HG-- extra : rebase_source : 04924f295134834cf66c0d9c4a31d43c614b3abf --- browser/components/syncedtabs/TabListComponent.js | 2 +- browser/components/syncedtabs/TabListView.js | 13 +++++++++---- .../test/xpcshell/test_TabListComponent.js | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/browser/components/syncedtabs/TabListComponent.js b/browser/components/syncedtabs/TabListComponent.js index 99037af71606..d98d5ede06ce 100644 --- a/browser/components/syncedtabs/TabListComponent.js +++ b/browser/components/syncedtabs/TabListComponent.js @@ -107,7 +107,7 @@ TabListComponent.prototype = { }, onOpenTab(url, where, params) { - this._window.openLinkIn(url, where, params); + this._window.openUILinkIn(url, where, params); }, onCopyTabLocation(url) { diff --git a/browser/components/syncedtabs/TabListView.js b/browser/components/syncedtabs/TabListView.js index 4b76728c8bf0..623ec5ec72a8 100644 --- a/browser/components/syncedtabs/TabListView.js +++ b/browser/components/syncedtabs/TabListView.js @@ -255,7 +255,7 @@ TabListView.prototype = { if (itemNode.classList.contains("tab")) { let url = itemNode.dataset.url; if (url) { - this.props.onOpenTab(url, event); + this.onOpenSelected(url, event); } } @@ -285,7 +285,7 @@ TabListView.prototype = { } else if (event.keyCode == this._window.KeyEvent.DOM_VK_RETURN) { let selectedNode = this.container.querySelector('.item.selected'); if (selectedNode.dataset.url) { - this.props.onOpenTab(selectedNode.dataset.url, event); + this.onOpenSelected(selectedNode.dataset.url, event); } else if (selectedNode) { this.props.onToggleBranch(selectedNode.dataset.id); } @@ -307,7 +307,12 @@ TabListView.prototype = { } }, - onOpenSelected(event) { + onOpenSelected(url, event) { + let where = getChromeWindow(this._window).whereToOpenLink(event); + this.props.onOpenTab(url, where, {}); + }, + + onOpenSelectedFromContextMenu(event) { let item = this._getSelectedTabNode(); if (item) { let where = event.target.getAttribute("where"); @@ -422,7 +427,7 @@ TabListView.prototype = { case "syncedTabsOpenSelectedInTab": case "syncedTabsOpenSelectedInWindow": case "syncedTabsOpenSelectedInPrivateWindow": - this.onOpenSelected(event); + this.onOpenSelectedFromContextMenu(event); break; case "syncedTabsBookmarkSelected": this.onBookmarkTab(); diff --git a/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js b/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js index cd6160bc57a5..dd8ba4ad603e 100644 --- a/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js +++ b/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js @@ -77,7 +77,7 @@ add_task(function* testActions() { }, PlacesUtils: { bookmarksMenuFolderId: "id" } }, - openLinkIn() {} + openUILinkIn() {} }; let component = new TabListComponent({ window: windowMock, store, View: null, SyncedTabs, @@ -121,9 +121,9 @@ add_task(function* testActions() { Assert.equal(windowMock.top.PlacesCommandHook.bookmarkLink.args[0][1], "uri"); Assert.equal(windowMock.top.PlacesCommandHook.bookmarkLink.args[0][2], "title"); - sinon.spy(windowMock, "openLinkIn"); + sinon.spy(windowMock, "openUILinkIn"); component.onOpenTab("uri", "where", "params"); - Assert.ok(windowMock.openLinkIn.calledWith("uri", "where", "params")); + Assert.ok(windowMock.openUILinkIn.calledWith("uri", "where", "params")); sinon.spy(clipboardHelperMock, "copyString"); component.onCopyTabLocation("uri");