Reduce use of eval()
This commit is contained in:
parent
7ef491d2e3
commit
faa0f5ffef
@ -99,11 +99,13 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
|
|||||||
if ('gSessionManager' in window &&
|
if ('gSessionManager' in window &&
|
||||||
TreeStyleTabUtils.getTreePref('compatibility.SessionManager')) {
|
TreeStyleTabUtils.getTreePref('compatibility.SessionManager')) {
|
||||||
if ('onLoad_proxy' in gSessionManager &&
|
if ('onLoad_proxy' in gSessionManager &&
|
||||||
'onLoad' in gSessionManager) {
|
'onLoad' in gSessionManager &&
|
||||||
eval('gSessionManager.onLoad = '+gSessionManager.onLoad.toSource().replace(
|
!gSessionManager.__treestyletab__onLoad) {
|
||||||
'{',
|
gSessionManager.__treestyletab__onLoad = gSessionManager.onLoad;
|
||||||
'{ TreeStyleTabService.init();'
|
gSessionManager.onLoad = function(...aArgs) {
|
||||||
));
|
TreeStyleTabService.init();
|
||||||
|
return gSessionManager.__treestyletab__onLoad(...aArgs);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
if ('load' in gSessionManager) {
|
if ('load' in gSessionManager) {
|
||||||
eval('gSessionManager.load = '+gSessionManager.load.toSource().replace(
|
eval('gSessionManager.load = '+gSessionManager.load.toSource().replace(
|
||||||
@ -191,13 +193,13 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
|
|||||||
if (TreeStyleTabUtils.getTreePref('compatibility.DuplicateInTabContext') &&
|
if (TreeStyleTabUtils.getTreePref('compatibility.DuplicateInTabContext') &&
|
||||||
'SchuzakJp' in window &&
|
'SchuzakJp' in window &&
|
||||||
'DuplicateInTabContext' in SchuzakJp &&
|
'DuplicateInTabContext' in SchuzakJp &&
|
||||||
typeof SchuzakJp.DuplicateInTabContext.Duplicate == 'function') {
|
typeof SchuzakJp.DuplicateInTabContext.Duplicate == 'function' &&
|
||||||
TreeStyleTabUtils.doPatching(SchuzakJp.DuplicateInTabContext.Duplicate, 'SchuzakJp.DuplicateInTabContext.Duplicate', function(aName, aSource) {
|
!SchuzakJp.DuplicateInTabContext.__treestyletab__Duplicate) {
|
||||||
return eval(aName+' = '+aSource.replace(
|
SchuzakJp.DuplicateInTabContext.__treestyletab__Duplicate = SchuzakJp.DuplicateInTabContext.Duplicate;
|
||||||
'{',
|
SchuzakJp.DuplicateInTabContext.Duplicate = function(aOriginalTab, ...aArgs) {
|
||||||
'{ gBrowser.treeStyleTab.onBeforeTabDuplicate(oriTab); '
|
gBrowser.treeStyleTab.onBeforeTabDuplicate(aOriginalTab);
|
||||||
));
|
return this.__treestyletab__Duplicate(aOriginalTab, ...aArgs);
|
||||||
}, 'treeStyleTab');
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user