From c101e5376d74fa15b523df8482545e8c9eff1fd1 Mon Sep 17 00:00:00 2001 From: YUKI Hiroshi Date: Mon, 5 Sep 2016 15:35:26 +0900 Subject: [PATCH] Reduce use of eval() --- content/treestyletab/windowHelperHacks.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/content/treestyletab/windowHelperHacks.js b/content/treestyletab/windowHelperHacks.js index 430b2fe5..146042a9 100644 --- a/content/treestyletab/windowHelperHacks.js +++ b/content/treestyletab/windowHelperHacks.js @@ -291,16 +291,17 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove // DragIt // https://addons.mozilla.org/firefox/addon/dragit-formerly-drag-de-go/ + // open new tabs as children of the current tab, for links or search terms if ('DragIt' in window && DragIt.tab && DragIt.tab.open && - TreeStyleTabUtils.getTreePref('compatibility.DragIt')) { - eval('DragIt.tab.open = '+ - DragIt.tab.open.toSource().replace( - 'try {', - 'try { TreeStyleTabService.readyToOpenChildTabNow(gBrowser);' - ) - ); + TreeStyleTabUtils.getTreePref('compatibility.DragIt') && + !DragIt.tab.__treestyletab__open) { + DragIt.tab.__treestyletab__open = DragIt.tab.open; + DragIt.tab.open = function(...aArgs) { + TreeStyleTabService.readyToOpenChildTabNow(gBrowser); + return this.__treestyletab__open(...aArgs); + }; } // Colorful Tabs