Move all tabs in the dragged tree to a newly opened window correctly on Firefox 19 and later (#472)

This commit is contained in:
Piro / YUKI Hiroshi 2013-03-06 00:58:51 +09:00
parent e180b42d61
commit 7985a98620

View File

@ -9,14 +9,28 @@ var TreeStyleTabWindowHelper = {
{ {
var source; var source;
var target; var target;
if ('gBrowserInit' in window && 'onLoad' in gBrowserInit) { // Firefox 16 and later (after https://bugzilla.mozilla.org/show_bug.cgi?id=731926 ) if ('gBrowserInit' in window) {
source = gBrowserInit.onLoad.toSource(); if (
target = 'gBrowserInit.onLoad'; '_delayedStartup' in gBrowserInit &&
(source = gBrowserInit._delayedStartup.toSource()) &&
source.indexOf('swapBrowsersAndCloseOther') > -1
) {
target = 'gBrowserInit._delayedStartup';
}
else if ( // legacy code for Firefox 18 and olders
'onLoad' in gBrowserInit &&
(source = gBrowserInit.onLoad.toSource()) &&
source.indexOf('swapBrowsersAndCloseOther') > -1
) {
target = 'gBrowserInit.onLoad';
}
} }
else if ('BrowserStartup' in window) { // legacy code for Firefox 15 and older else if ('BrowserStartup' in window) { // legacy code for Firefox 15 and olders
source = window.BrowserStartup.toSource(); source = window.BrowserStartup.toSource();
target = 'BrowserStartup'; target = 'BrowserStartup';
} }
if (!target)
dump('Tree Style Tab: failed to initialize startup function!');
if (source.indexOf('!MultipleTabService.tearOffSelectedTabsFromRemote()') > -1) { if (source.indexOf('!MultipleTabService.tearOffSelectedTabsFromRemote()') > -1) {
eval(target+' = '+source.replace( eval(target+' = '+source.replace(
'!MultipleTabService.tearOffSelectedTabsFromRemote()', '!MultipleTabService.tearOffSelectedTabsFromRemote()',