Don't override BrowserReloadOrDuplicate, BrowserForward, BrowserBack, and gotoHistoryIndex anymore

This commit is contained in:
Piro / YUKI Hiroshi 2012-09-15 12:32:58 +09:00
parent f4d43a5d93
commit 18639ccbea
2 changed files with 11 additions and 47 deletions

View File

@ -263,46 +263,13 @@ var TreeStyleTabWindowHelper = {
}
}
let (functions = this._splitFunctionNames(<![CDATA[
window.duplicateTab.gotoHistoryIndex
window.duplicateTab.BrowserBack
window.duplicateTab.BrowserForward
window.duplicatethistab.gotoHistoryIndex
window.duplicatethistab.BrowserBack
window.duplicatethistab.BrowserForward
window.__rewindforward__BrowserForward
window.__rewindforward__BrowserBack
window.gotoHistoryIndex
window.BrowserForward
window.BrowserBack
]]>)) {
for (let i = 0, maxi = functions.length; i < maxi; i++)
{
let func = functions[i];
let source = this._getFunctionSource(func);
if (!source || !/^\(?function (gotoHistoryIndex|BrowserForward|BrowserBack)/.test(source))
continue;
eval(func+' = '+source.replace(
/((?:openUILinkIn|duplicateTabIn)\()/g,
'TreeStyleTabService.onBeforeOpenLink(where); $1'
));
}
}
let (functions = this._splitFunctionNames(<![CDATA[
window.BrowserReloadOrDuplicate
]]>)) {
for (let i = 0, maxi = functions.length; i < maxi; i++)
{
let func = functions[i];
let source = this._getFunctionSource(func);
if (!source || !/^\(?function (BrowserReloadOrDuplicate)/.test(source))
continue;
eval(func+' = '+source.replace(
/((?:openUILinkIn|duplicateTabIn)\([^\)]+\))/g,
'(TreeStyleTabService.onBeforeTabReloadOrDuplicate(where), $&)'
));
}
if (window.duplicateTabIn) {
eval('window.duplicateTabIn = '+
window.duplicateTabIn.toSource().replace(
'{',
'{ gBrowser.treeStyleTab.onBeforeTabDuplicate(aTab, where); '
)
);
}
let (functions = this._splitFunctionNames(<![CDATA[

View File

@ -1165,18 +1165,15 @@ TreeStyleTabWindow.prototype = {
},
_clickEventOnNewTabButtonHandled : false,
onBeforeTabDuplicate : function TSTWindow_onBeforeTabDuplicate(aTab)
onBeforeTabDuplicate : function TSTWindow_onBeforeTabDuplicate(aTab, aWhere)
{
if (aWhere && aWhere.indexOf('tab') != 0)
return;
var b = this.getTabBrowserFromChild(aTab) || this.browser;
this._handleNewTabCommand(aTab || b.selectedTab, this.getTreePref('autoAttach.duplicateTabCommand'));
},
onBeforeTabReloadOrDuplicate : function TSTWindow_onBeforeTabReloadOrDuplicate(aWhere)
{
if (aWhere == 'tab' || aWhere == 'tabshifted')
this.onBeforeTabDuplicate(null);
},
onBeforeOpenLink : function TSTWindow_onBeforeOpenLink(aWhere, aOwner)
{
if (aWhere == 'tab' || aWhere == 'tabshifted')