Bug 1262310 - Fix opening synced tabs from the sidebar. r=markh

MozReview-Commit-ID: 8VHbEqsyuF2

--HG--
extra : rebase_source : 04924f295134834cf66c0d9c4a31d43c614b3abf
This commit is contained in:
Kit Cambridge 2016-04-05 17:06:00 -07:00
Родитель ee27759c39
Коммит b9d8f2d371
3 изменённых файлов: 13 добавлений и 8 удалений

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

@ -107,7 +107,7 @@ TabListComponent.prototype = {
},
onOpenTab(url, where, params) {
this._window.openLinkIn(url, where, params);
this._window.openUILinkIn(url, where, params);
},
onCopyTabLocation(url) {

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

@ -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();

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

@ -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");