diff --git a/content/treestyletab/windowHelper.js b/content/treestyletab/windowHelper.js index 2edf6b38..b75cbe67 100644 --- a/content/treestyletab/windowHelper.js +++ b/content/treestyletab/windowHelper.js @@ -272,12 +272,6 @@ var TreeStyleTabWindowHelper = { }; }, this); - window.__treestyletab__duplicateTabIn = window.duplicateTabIn; - window.duplicateTabIn = function(aTab, where, delta) { - gBrowser.treeStyleTab.onBeforeTabDuplicate(aTab, where, delta); - return window.__treestyletab__duplicateTabIn.call(this, aTab, where, delta); - }; - window.__treestyletab__BrowserGoHome = window.BrowserGoHome; window.BrowserGoHome = function(aEvent) { aEvent = TreeStyleTabService.onBeforeGoHome(aEvent, gBrowser); diff --git a/modules/utils.js b/modules/utils.js index 62a1657b..ec5f8294 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -799,4 +799,11 @@ prefs.addPrefListener(TreeStyleTabUtils); TabAttributesInternal._skipAttrs.add(name); }); } + + let { SessionStore } = Cu.import('resource:///modules/sessionstore/SessionStore.jsm', {}); + SessionStore.__treestyletab__duplicateTab = SessionStore.duplicateTab; + SessionStore.duplicateTab = function(aWindow, aTab, aDelta = 0) { + aWindow.gBrowser.treeStyleTab.onBeforeTabDuplicate(aWindow, aTab, aDelta); + return this.__treestyletab__duplicateTab.call(this, aWindow, aTab, aDelta); + }; } diff --git a/modules/window.js b/modules/window.js index 2760ea83..20e822a6 100644 --- a/modules/window.js +++ b/modules/window.js @@ -1365,11 +1365,8 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, { }, _clickEventOnNewTabButtonHandled : false, - onBeforeTabDuplicate : function TSTWindow_onBeforeTabDuplicate(aTab, aWhere, aDelta) + onBeforeTabDuplicate : function TSTWindow_onBeforeTabDuplicate(aWindow, aTab, aDelta) { - if (aWhere && aWhere.indexOf('tab') != 0) - return; - var b = this.getTabBrowserFromChild(aTab) || this.browser; var behaviorPref = !aDelta ? 'autoAttach.duplicateTabCommand' : aDelta < 0 ? 'autoAttach.duplicateTabCommand.back' :