diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 2f8d1488..d3497446 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -1941,14 +1941,13 @@ catch(e) { if (remoteService.hasChildTabs(remoteTab) || remoteMultipleTabService.isSelected(remoteTab)) { var remoteBrowser = remoteService.getTabBrowserFromChild(remoteTab); - var actionInfo = { - action : this.kACTIONS_FOR_DESTINATION | this.kACTION_IMPORT - }; - var tabsInfo = remoteBrowser.treeStyleTab.getDraggedTabsInfoFromOneTab(actionInfo, remoteTab); - if (tabsInfo.draggedTabs.length == remoteBrowser.mTabContainer.childNodes.length) { + if (remoteBrowser.treeStyleTab.isDraggingAllTabs(remoteTab)) { window.close(); } else { + var actionInfo = { + action : this.kACTIONS_FOR_DESTINATION | this.kACTION_IMPORT + }; window.setTimeout(function() { var blankTab = gBrowser.selectedTab; gBrowser.treeStyleTab.performDrop(actionInfo, remoteTab); diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index c3aa4e2a..ef01bafb 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -404,6 +404,13 @@ TreeStyleTabBrowser.prototype = { ) ); + if ('_onDragEnd' in b) { + eval('b._onDragEnd = '+b._onDragEnd.toSource().replace( + 'this._replaceTabWithWindow(', + 'if (this.treeStyleTab.isDraggingAllTabs(draggedTab)) return; $&' + )); + } + var tabs = b.mTabContainer.childNodes; for (var i = 0, maxi = tabs.length; i < maxi; i++) { @@ -2358,6 +2365,15 @@ TreeStyleTabBrowser.prototype = { xpathResult.snapshotItem(i).removeAttribute(this.kDROP_POSITION); } }, + + isDraggingAllTabs : function(aTab) + { + var actionInfo = { + action : this.kACTIONS_FOR_DESTINATION | this.kACTION_IMPORT + }; + var tabsInfo = this.getDraggedTabsInfoFromOneTab(actionInfo, aTab); + return tabsInfo.draggedTabs.length == this.mTabBrowser.mTabContainer.childNodes.length; + }, /* commands */