Handle duplicated tabs totally

This commit is contained in:
YUKI Hiroshi 2016-07-05 14:52:43 +09:00
parent 51de133b0d
commit d7caa5ac59
3 changed files with 8 additions and 10 deletions

View File

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

View File

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

View File

@ -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' :