Don't override same function twice

This commit is contained in:
YUKI Hiroshi 2016-01-21 21:02:26 +09:00
parent de50d19993
commit 1bf54f5998

View File

@ -75,16 +75,13 @@ var TreeStyleTabWindowHelper = {
Object.keys(window.__treestyletab__openLinkIn_extraParams).forEach(function(aKey) { Object.keys(window.__treestyletab__openLinkIn_extraParams).forEach(function(aKey) {
aParams[aKey] = window.__treestyletab__openLinkIn_extraParams[aKey]; aParams[aKey] = window.__treestyletab__openLinkIn_extraParams[aKey];
}); });
var result;
try { try {
result = window.__treestyletab__openLinkIn.apply(this, [aUrl, aWhere, aParams].concat(aArgs)); TreeStyleTabService.onBeforeOpenLinkWithTab(gBrowser.selectedTab, aParams);
return window.__treestyletab__openLinkIn.apply(this, [aUrl, aWhere, aParams].concat(aArgs));
} }
catch(e) { finally {
dump(e+'\n');
}
if (window.__treestyletab__openLinkIn_extraParams)
delete window.__treestyletab__openLinkIn_extraParams; delete window.__treestyletab__openLinkIn_extraParams;
return result; }
}; };
window.__treestyletab__handleLinkClick = window.handleLinkClick; window.__treestyletab__handleLinkClick = window.handleLinkClick;
@ -93,16 +90,12 @@ var TreeStyleTabWindowHelper = {
event : aEvent, event : aEvent,
linkNode : aLinkNode linkNode : aLinkNode
}; };
var result;
try { try {
result = window.__treestyletab__handleLinkClick.apply(this, [aEvent, aHref, aLinkNode].concat(aArgs)); return window.__treestyletab__handleLinkClick.apply(this, [aEvent, aHref, aLinkNode].concat(aArgs));
} }
catch(e) { finally {
dump(e+'\n');
}
if (window.__treestyletab__openLinkIn_extraParams)
delete window.__treestyletab__openLinkIn_extraParams; delete window.__treestyletab__openLinkIn_extraParams;
return result; }
}; };
this.overrideExtensionsPreInit(); // windowHelperHacks.js this.overrideExtensionsPreInit(); // windowHelperHacks.js
@ -239,12 +232,6 @@ var TreeStyleTabWindowHelper = {
return BrowserSearch.__treestyletab__loadSearch.call(this, aSearchText, aUseNewTab, aPurpose); return BrowserSearch.__treestyletab__loadSearch.call(this, aSearchText, aUseNewTab, aPurpose);
}; };
window.__treestyletab__openLinkIn = window.openLinkIn;
window.openLinkIn = function(aUrl, aWhere, aParams) {
TreeStyleTabService.onBeforeOpenLinkWithTab(gBrowser.selectedTab, aParams);
return window.__treestyletab__openLinkIn.call(this, aUrl, aWhere, aParams);
};
[ [
{ owner: window.permaTabs && window.permaTabs.utils && window.permaTabs.utils.wrappedFunctions, { owner: window.permaTabs && window.permaTabs.utils && window.permaTabs.utils.wrappedFunctions,
name: 'window.contentAreaClick' }, name: 'window.contentAreaClick' },