Update initialization process for changes introduced by https://bugzilla.mozilla.org/show_bug.cgi?id=731926

This commit is contained in:
Piro / SHIMODA Hiroshi 2012-05-17 09:32:52 +09:00
parent 521844f708
commit da657f8950

View File

@ -7,15 +7,24 @@ var TreeStyleTabWindowHelper = {
preInit : function TSTWH_preInit() preInit : function TSTWH_preInit()
{ {
var source = window.BrowserStartup.toSource(); var source;
var target;
if ('gBrowserInit' in window && 'onLoad' in gBrowserInit) { // Firefox 16 and later (after https://bugzilla.mozilla.org/show_bug.cgi?id=731926 )
source = gBrowserInit.onLoad.toSource();
target = 'gBrowserInit.onLoad';
}
else if ('BrowserStartup' in window) { // legacy code for Firefox 15 and older
source = window.BrowserStartup.toSource();
target = 'gBrowserInit.onLoad';
}
if (source.indexOf('!MultipleTabService.tearOffSelectedTabsFromRemote()') > -1) { if (source.indexOf('!MultipleTabService.tearOffSelectedTabsFromRemote()') > -1) {
eval('window.BrowserStartup = '+source.replace( eval(target+' = '+source.replace(
'!MultipleTabService.tearOffSelectedTabsFromRemote()', '!MultipleTabService.tearOffSelectedTabsFromRemote()',
'!TreeStyleTabService.tearOffSubtreeFromRemote() && $&' '!TreeStyleTabService.tearOffSubtreeFromRemote() && $&'
)); ));
} }
else if (source.indexOf('gBrowser.swapBrowsersAndCloseOther') > -1) { else if (source.indexOf('gBrowser.swapBrowsersAndCloseOther') > -1) {
eval('window.BrowserStartup = '+source.replace( eval(target+' = '+source.replace(
'gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, uriToLoad);', 'gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, uriToLoad);',
'if (!TreeStyleTabService.tearOffSubtreeFromRemote()) { $& }' 'if (!TreeStyleTabService.tearOffSubtreeFromRemote()) { $& }'
)); ));