From 488116670bbcb6ca063e1c459aab411a762bb7ff Mon Sep 17 00:00:00 2001 From: YUKI Hiroshi Date: Mon, 5 Sep 2016 16:52:40 +0900 Subject: [PATCH] Reduce use of eval() --- content/treestyletab/windowHelperHacks.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/treestyletab/windowHelperHacks.js b/content/treestyletab/windowHelperHacks.js index 1415047e..1f333c00 100644 --- a/content/treestyletab/windowHelperHacks.js +++ b/content/treestyletab/windowHelperHacks.js @@ -602,13 +602,13 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove // https://addons.mozilla.org/firefox/addon/context-search/ if ('contextsearch' in window && 'search' in window.contextsearch && - TreeStyleTabUtils.getTreePref('compatibility.ContextSearch')) { - eval('contextsearch.search = '+ - contextsearch.search.toSource().replace( - 'var newTab = ', - 'TreeStyleTabService.readyToOpenChildTab(); $&' - ) - ); + TreeStyleTabUtils.getTreePref('compatibility.ContextSearch') && + !contextsearch.__treestyletab__search) { + contextsearch.__treestyletab__search = contextsearch.search; + contextsearch.search = function(...aArgs) { + TreeStyleTabService.readyToOpenChildTabNow(); + return this.__treestyletab__search(...aArgs); + }; } // Tile Tabs