Reduce use of eval()

This commit is contained in:
YUKI Hiroshi 2016-09-05 15:28:44 +09:00
parent e25129166d
commit 77b02db495

View File

@ -207,15 +207,13 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
// https://addons.mozilla.org/firefox/addon/selection-links/ // https://addons.mozilla.org/firefox/addon/selection-links/
if ('selectionlinks' in window && if ('selectionlinks' in window &&
'parseSelection' in selectionlinks && 'parseSelection' in selectionlinks &&
TreeStyleTabUtils.getTreePref('compatibility.SelectionLinks')) { TreeStyleTabUtils.getTreePref('compatibility.SelectionLinks') &&
eval('selectionlinks.parseSelection = '+ !selectionlinks.__treestyletab__parseSelection) {
selectionlinks.parseSelection.toSource().replace( selectionlinks.__treestyletab__parseSelection = selectionlinks.parseSelection;
/((?:[^\s:;]+.selectedTab\s*=\s*)?([^\s:;]+).addTab\()/g, selectionlinks.parseSelection = function(...aArgs) {
' if ($2.treeStyleTab)\n' + gBrowser.treeStyleTab.readyToOpenChildTabNow(gBrowser.selectedTab, true);
' $2.treeStyleTab.readyToOpenChildTab(focusedWindow);\n' + return selectionlinks.__treestyletab__parseSelection(...aArgs);
'$1' };
)
);
} }