Reduce eval hack
This commit is contained in:
parent
190d8cd71c
commit
d5b05b6017
@ -505,24 +505,34 @@ var TreeStyleTabWindowHelper = {
|
|||||||
));
|
));
|
||||||
}, 'treeStyleTab');
|
}, 'treeStyleTab');
|
||||||
|
|
||||||
TreeStyleTabUtils.doPatching(b.loadTabs, 'b.loadTabs', function(aName, aSource) {
|
b.__treestyletab__loadTabs = b.loadTabs;
|
||||||
return eval(aName+' = '+aSource.replace(
|
b.loadTabs = function(aURIs, aLoadInBackground, aReplace, ...aArgs) {
|
||||||
'var tabNum = ',
|
if (aReplace)
|
||||||
'if (this.treeStyleTab.readiedToAttachNewTabGroup)\n' +
|
this.treeStyleTab.readyToOpenChildTab(this.selectedTab, true);
|
||||||
' TreeStyleTabService.readyToOpenChildTab(firstTabAdded || this.selectedTab, true);\n' +
|
else
|
||||||
'$&'
|
this.treeStyleTab.nextOpenedTabToBeParent = true;
|
||||||
).replace(
|
|
||||||
'if (!aLoadInBackground)',
|
var result;
|
||||||
'if (TreeStyleTabService.checkToOpenChildTab(this))\n' +
|
var tabs = [];
|
||||||
' TreeStyleTabService.stopToOpenChildTab(this);\n' +
|
var firstTabAdded;
|
||||||
'$&'
|
try {
|
||||||
).replace(
|
tabs = this.treeStyleTab.doAndGetNewTabs((function() {
|
||||||
'this.selectedTab = firstTabAdded;',
|
result = this.__treestyletab__loadTabs.apply(this, [aURIs, aLoadInBackground, aReplace].concat(aArgs));
|
||||||
'this.selectedTab = aURIs[0].indexOf("about:treestyletab-group") < 0 ? \n' +
|
}).bind(this));
|
||||||
' firstTabAdded :\n' +
|
firstTabAdded = tabs[0];
|
||||||
' TreeStyleTabService.getNextTab(firstTabAdded) ;'
|
}
|
||||||
));
|
finally {
|
||||||
}, 'TreeStyleTab');
|
if (!aReplace && firstTabAdded) {
|
||||||
|
this.selectedTab = aURIs[0].indexOf('about:treestyletab-group') == 0 ?
|
||||||
|
TreeStyleTabService.getNextTab(firstTabAdded) :
|
||||||
|
firstTabAdded;
|
||||||
|
}
|
||||||
|
if (this.treeStyleTab.checkToOpenChildTab(this))
|
||||||
|
this.treeStyleTab.stopToOpenChildTab(this);
|
||||||
|
delete this.treeStyleTab.nextOpenedTabToBeParent;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
TreeStyleTabUtils.doPatching(b._beginRemoveTab, 'b._beginRemoveTab', function(aName, aSource) {
|
TreeStyleTabUtils.doPatching(b._beginRemoveTab, 'b._beginRemoveTab', function(aName, aSource) {
|
||||||
return eval(aName+' = '+aSource.replace(
|
return eval(aName+' = '+aSource.replace(
|
||||||
|
@ -3287,8 +3287,15 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
*/
|
*/
|
||||||
b._lastRelatedTab = lastRelatedTab;
|
b._lastRelatedTab = lastRelatedTab;
|
||||||
|
|
||||||
|
// this is the first tab of loading group.
|
||||||
|
if (this.nextOpenedTabToBeParent) {
|
||||||
|
this.readyToOpenChildTab(tab, true);
|
||||||
|
delete this.nextOpenedTabToBeParent;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
loadingMultipleTabs : false,
|
||||||
_addedCountInThisLoop : 0,
|
_addedCountInThisLoop : 0,
|
||||||
_addedCountClearTimer : null,
|
_addedCountClearTimer : null,
|
||||||
_checkRestoringWindowTimerOnTabAdded : null,
|
_checkRestoringWindowTimerOnTabAdded : null,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user