From 1bf54f59981b6cdf4c58b5427e2b607f42c4882f Mon Sep 17 00:00:00 2001 From: YUKI Hiroshi Date: Thu, 21 Jan 2016 21:02:26 +0900 Subject: [PATCH] Don't override same function twice --- content/treestyletab/windowHelper.js | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/content/treestyletab/windowHelper.js b/content/treestyletab/windowHelper.js index 53cbd91f..858e6572 100644 --- a/content/treestyletab/windowHelper.js +++ b/content/treestyletab/windowHelper.js @@ -75,16 +75,13 @@ var TreeStyleTabWindowHelper = { Object.keys(window.__treestyletab__openLinkIn_extraParams).forEach(function(aKey) { aParams[aKey] = window.__treestyletab__openLinkIn_extraParams[aKey]; }); - var result; 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) { - dump(e+'\n'); - } - if (window.__treestyletab__openLinkIn_extraParams) + finally { delete window.__treestyletab__openLinkIn_extraParams; - return result; + } }; window.__treestyletab__handleLinkClick = window.handleLinkClick; @@ -93,16 +90,12 @@ var TreeStyleTabWindowHelper = { event : aEvent, linkNode : aLinkNode }; - var result; 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) { - dump(e+'\n'); - } - if (window.__treestyletab__openLinkIn_extraParams) + finally { delete window.__treestyletab__openLinkIn_extraParams; - return result; + } }; this.overrideExtensionsPreInit(); // windowHelperHacks.js @@ -239,12 +232,6 @@ var TreeStyleTabWindowHelper = { 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, name: 'window.contentAreaClick' },