Reduce use of eval()
This commit is contained in:
parent
2ff3399300
commit
750ada61d8
@ -432,33 +432,21 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
if ('mouselessbrowsing' in window &&
|
if ('mouselessbrowsing' in window &&
|
||||||
'EventHandler' in mouselessbrowsing &&
|
'EventHandler' in mouselessbrowsing &&
|
||||||
TreeStyleTabUtils.getTreePref('compatibility.MouselessBrowsing')) {
|
TreeStyleTabUtils.getTreePref('compatibility.MouselessBrowsing')) {
|
||||||
if ('execute' in mouselessbrowsing.EventHandler) {
|
if ('execute' in mouselessbrowsing.EventHandler &&
|
||||||
eval('mouselessbrowsing.EventHandler.execute = '+
|
!mouselessbrowsing.EventHandler.__treestyletab__execute) {
|
||||||
mouselessbrowsing.EventHandler.execute.toSource().replace(
|
mouselessbrowsing.EventHandler.__treestyletab__execute = mouselessbrowsing.EventHandler.execute;
|
||||||
'{',
|
mouselessbrowsing.EventHandler.execute = function(...aArgs) {
|
||||||
'{ var Prefs = mlb_common.Prefs;'+
|
TreeStyleTabService.readyToOpenChildTabNow();
|
||||||
' var Utils = mlb_common.Utils;'+
|
return this.__treestyletab__execute(...aArgs);
|
||||||
' var MlbUtils = mouselessbrowsing.MlbUtils;'
|
};
|
||||||
).replace(
|
|
||||||
/((?:var [^=]+ = )?Utils.openUrlInNewTab\()/g,
|
|
||||||
'TreeStyleTabService.readyToOpenChildTab(); $1'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if ('openLinkInOtherLocationViaPostfixKey' in mouselessbrowsing.EventHandler) {
|
if ('openLinkInOtherLocationViaPostfixKey' in mouselessbrowsing.EventHandler &&
|
||||||
eval('mouselessbrowsing.EventHandler.openLinkInOtherLocationViaPostfixKey = '+
|
!mouselessbrowsing.EventHandler.__treestyletab__openLinkInOtherLocationViaPostfixKey) {
|
||||||
mouselessbrowsing.EventHandler.openLinkInOtherLocationViaPostfixKey.toSource().replace(
|
mouselessbrowsing.EventHandler.__treestyletab__openLinkInOtherLocationViaPostfixKey = mouselessbrowsing.EventHandler.openLinkInOtherLocationViaPostfixKey;
|
||||||
'{',
|
mouselessbrowsing.EventHandler.openLinkInOtherLocationViaPostfixKey = function(...aArgs) {
|
||||||
'{ var Prefs = mlb_common.Prefs;'+
|
TreeStyleTabService.readyToOpenChildTabNow();
|
||||||
' var Utils = mlb_common.Utils;'+
|
return this.__treestyletab__openLinkInOtherLocationViaPostfixKey(...aArgs);
|
||||||
' var MlbUtils = mouselessbrowsing.MlbUtils;'+
|
};
|
||||||
' var MlbCommon = mouselessbrowsing.MlbCommon;'+
|
|
||||||
' var ShortcutManager = mlb_common.ShortcutManager;'
|
|
||||||
).replace(
|
|
||||||
'Utils.openUrlInNewTab(',
|
|
||||||
'TreeStyleTabService.readyToOpenChildTab(); $&'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user