some compatibility hacks for other addons didn't work unexpectedly. (regression, fix for https://github.com/piroor/treestyletab/issues/117 )
This commit is contained in:
parent
dfcb7f14f3
commit
f2fc943216
@ -371,14 +371,14 @@ TreeStyleTabWindowHelper.overrideExtensionsBeforeBrowserInit = function TSTWH_ov
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'unload':
|
case 'unload':
|
||||||
window.removeEventListener('TreeStyleTabTabbarPositionChanged', this, false);
|
document.removeEventListener('TreeStyleTabTabbarPositionChanged', this, false);
|
||||||
window.removeEventListener('unload', this, true);
|
document.removeEventListener('unload', this, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener('TreeStyleTabTabbarPositionChanged', listener, false);
|
document.addEventListener('TreeStyleTabTabbarPositionChanged', listener, false);
|
||||||
window.addEventListener('unload', listener, true);
|
document.addEventListener('unload', listener, false);
|
||||||
|
|
||||||
if ('openSelectedLinks' in tabberwocky) {
|
if ('openSelectedLinks' in tabberwocky) {
|
||||||
eval('tabberwocky.openSelectedLinks = '+
|
eval('tabberwocky.openSelectedLinks = '+
|
||||||
@ -464,27 +464,27 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
{
|
{
|
||||||
switch (aEvent.type)
|
switch (aEvent.type)
|
||||||
{
|
{
|
||||||
case TreeStyleTabService.kEVENT_TYPE_TAB_COLLAPSED_STATE_CHANGED:
|
case sv.kEVENT_TYPE_TAB_COLLAPSED_STATE_CHANGED:
|
||||||
TabmixTabbar.updateScrollStatus();
|
TabmixTabbar.updateScrollStatus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TreeStyleTabService.kEVENT_TYPE_FOCUS_NEXT_TAB:
|
case sv.kEVENT_TYPE_FOCUS_NEXT_TAB:
|
||||||
let mode = TreeStyleTabService.getPref('extensions.tabmix.focusTab');
|
let mode = sv.getPref('extensions.tabmix.focusTab');
|
||||||
if (mode != 2 && mode != 5)
|
if (mode != 2 && mode != 5)
|
||||||
aEvent.preventDefault();
|
aEvent.preventDefault();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'unload':
|
case 'unload':
|
||||||
window.removeEventListener(TreeStyleTabService.kEVENT_TYPE_TAB_COLLAPSED_STATE_CHANGED, this, false);
|
document.removeEventListener(sv.kEVENT_TYPE_TAB_COLLAPSED_STATE_CHANGED, this, false);
|
||||||
window.removeEventListener(TreeStyleTabService.kEVENT_TYPE_FOCUS_NEXT_TAB, this, false);
|
document.removeEventListener(sv.kEVENT_TYPE_FOCUS_NEXT_TAB, this, false);
|
||||||
window.removeEventListener('unload', this, true);
|
document.removeEventListener('unload', this, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener(sv.kEVENT_TYPE_TAB_COLLAPSED_STATE_CHANGED, listener, false);
|
document.addEventListener(sv.kEVENT_TYPE_TAB_COLLAPSED_STATE_CHANGED, listener, false);
|
||||||
window.addEventListener(sv.kEVENT_TYPE_FOCUS_NEXT_TAB, listener, false);
|
document.addEventListener(sv.kEVENT_TYPE_FOCUS_NEXT_TAB, listener, false);
|
||||||
window.addEventListener('unload', listener, true);
|
document.addEventListener('unload', listener, false);
|
||||||
|
|
||||||
gBrowser.treeStyleTab.internallyTabMovingCount++; // until "TMmoveTabTo" method is overwritten
|
gBrowser.treeStyleTab.internallyTabMovingCount++; // until "TMmoveTabTo" method is overwritten
|
||||||
}
|
}
|
||||||
@ -556,16 +556,16 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'unload':
|
case 'unload':
|
||||||
window.removeEventListener('TreeStyleTabAttached', this, false);
|
document.removeEventListener('TreeStyleTabAttached', this, false);
|
||||||
window.removeEventListener('TreeStyleTabParted', this, false);
|
document.removeEventListener('TreeStyleTabParted', this, false);
|
||||||
window.removeEventListener('unload', this, true);
|
document.removeEventListener('unload', this, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener('TreeStyleTabAttached', listener, false);
|
document.addEventListener('TreeStyleTabAttached', listener, false);
|
||||||
window.addEventListener('TreeStyleTabParted', listener, false);
|
document.addEventListener('TreeStyleTabParted', listener, false);
|
||||||
window.addEventListener('unload', listener, true);
|
document.addEventListener('unload', listener, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FLST (Focus Last Selected Tab)
|
// FLST (Focus Last Selected Tab)
|
||||||
@ -824,17 +824,16 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'unload':
|
case 'unload':
|
||||||
var t = aEvent.currentTarget;
|
document.removeEventListener('TreeStyleTabAutoHideStateChanging', this, false);
|
||||||
t.removeEventListener('TreeStyleTabAutoHideStateChanging', this, false);
|
document.removeEventListener('unload', this, false);
|
||||||
t.removeEventListener('unload', this, true);
|
document.removeEventListener('fullscreen', this, false);
|
||||||
t.removeEventListener('fullscreen', this, false);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener('TreeStyleTabAutoHideStateChanging', autoHideEventListener, false);
|
document.addEventListener('TreeStyleTabAutoHideStateChanging', autoHideEventListener, false);
|
||||||
window.addEventListener('fullscreen', autoHideEventListener, false);
|
document.addEventListener('fullscreen', autoHideEventListener, false);
|
||||||
window.addEventListener('unload', autoHideEventListener, true);
|
document.addEventListener('unload', autoHideEventListener, false);
|
||||||
|
|
||||||
if ('MoveContent' in autoHIDE) {
|
if ('MoveContent' in autoHIDE) {
|
||||||
eval('autoHIDE.MoveContent = '+autoHIDE.MoveContent.toSource().replace(
|
eval('autoHIDE.MoveContent = '+autoHIDE.MoveContent.toSource().replace(
|
||||||
@ -942,10 +941,10 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
case 'extensions.stm.tabBarMultiRows':
|
case 'extensions.stm.tabBarMultiRows':
|
||||||
case 'extensions.stm.tabBarPosition':
|
case 'extensions.stm.tabBarPosition':
|
||||||
if (
|
if (
|
||||||
TreeStyleTabService.getPref('extensions.stm.tabBarMultiRows') &&
|
sv.getPref('extensions.stm.tabBarMultiRows') &&
|
||||||
TreeStyleTabService.getPref('extensions.stm.tabBarPosition') == 0
|
sv.getPref('extensions.stm.tabBarPosition') == 0
|
||||||
) {
|
) {
|
||||||
TreeStyleTabService.setPref('extensions.stm.tabBarMultiRows.override', false);
|
sv.setPref('extensions.stm.tabBarMultiRows.override', false);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -960,11 +959,11 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
};
|
};
|
||||||
observer.observe(null, null, 'extensions.stm.tabBarMultiRows');
|
observer.observe(null, null, 'extensions.stm.tabBarMultiRows');
|
||||||
observer.observe(null, null, 'extensions.stm.newTabBtnPos');
|
observer.observe(null, null, 'extensions.stm.newTabBtnPos');
|
||||||
TreeStyleTabService.addPrefListener(observer);
|
sv.addPrefListener(observer);
|
||||||
window.addEventListener('unload', function() {
|
document.addEventListener('unload', function() {
|
||||||
window.removeEventListener('unload', arguments.callee, true);
|
document.removeEventListener('unload', arguments.callee, false);
|
||||||
TreeStyleTabService.removePrefListener(observer);
|
sv.removePrefListener(observer);
|
||||||
}, true);
|
}, false);
|
||||||
|
|
||||||
let warnPref = 'extensions.treestyletab.compatibility.STM.warnForNewTabPosition';
|
let warnPref = 'extensions.treestyletab.compatibility.STM.warnForNewTabPosition';
|
||||||
if (
|
if (
|
||||||
@ -990,7 +989,7 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
sv.setPref(warnPref, false);
|
sv.setPref(warnPref, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeStyleTabService.registerTabFocusAllowance(function(aTabBrowser) {
|
sv.registerTabFocusAllowance(function(aTabBrowser) {
|
||||||
return aTabBrowser.treeStyleTab.getPref('extensions.stm.focusAfterCloseTab') == 0;
|
return aTabBrowser.treeStyleTab.getPref('extensions.stm.focusAfterCloseTab') == 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1043,9 +1042,9 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
switch (aEvent.type)
|
switch (aEvent.type)
|
||||||
{
|
{
|
||||||
case 'unload':
|
case 'unload':
|
||||||
window.removeEventListener('unload', listener, true);
|
document.removeEventListener('unload', listener, false);
|
||||||
window.removeEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false);
|
document.removeEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false);
|
||||||
window.removeEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false);
|
document.removeEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false);
|
||||||
case sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION:
|
case sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION:
|
||||||
if (gURLBar && listening)
|
if (gURLBar && listening)
|
||||||
gURLBar.removeEventListener('click', listener, true);
|
gURLBar.removeEventListener('click', listener, true);
|
||||||
@ -1071,9 +1070,9 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener('unload', listener, true);
|
document.addEventListener('unload', listener, false);
|
||||||
window.addEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false);
|
document.addEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false);
|
||||||
window.addEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false);
|
document.addEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false);
|
||||||
if (gURLBar && !listening) {
|
if (gURLBar && !listening) {
|
||||||
gURLBar.addEventListener('click', listener, true);
|
gURLBar.addEventListener('click', listener, true);
|
||||||
listening = true;
|
listening = true;
|
||||||
@ -1200,17 +1199,17 @@ TreeStyleTabWindowHelper.overrideExtensionsDelayed = function TSTWH_overrideExte
|
|||||||
|
|
||||||
case 'unload':
|
case 'unload':
|
||||||
titlebar.removeEventListener('DOMAttrModified', this, true);
|
titlebar.removeEventListener('DOMAttrModified', this, true);
|
||||||
window.removeEventListener('beforecustomization', this, false);
|
document.removeEventListener('beforecustomization', this, false);
|
||||||
window.removeEventListener('aftercustomization', this, false);
|
document.removeEventListener('aftercustomization', this, false);
|
||||||
window.removeEventListener('unload', this, true);
|
document.removeEventListener('unload', this, false);
|
||||||
personalTitlebar = null;
|
personalTitlebar = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener('beforecustomization', listener, false);
|
document.addEventListener('beforecustomization', listener, false);
|
||||||
window.addEventListener('aftercustomization', listener, false);
|
document.addEventListener('aftercustomization', listener, false);
|
||||||
window.addEventListener('unload', listener, true);
|
document.addEventListener('unload', listener, false);
|
||||||
titlebar.addEventListener('DOMAttrModified', listener, true);
|
titlebar.addEventListener('DOMAttrModified', listener, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1247,18 +1246,18 @@ TreeStyleTabWindowHelper.overrideExtensionsDelayed = function TSTWH_overrideExte
|
|||||||
|
|
||||||
case 'unload':
|
case 'unload':
|
||||||
menu.removeEventListener('command', this, true);
|
menu.removeEventListener('command', this, true);
|
||||||
window.removeEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false);
|
document.removeEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false);
|
||||||
window.removeEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false);
|
document.removeEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false);
|
||||||
window.removeEventListener('unload', this, true);
|
document.removeEventListener('unload', this, false);
|
||||||
menu = null;
|
menu = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
menu.addEventListener('command', listener, false);
|
menu.addEventListener('command', listener, false);
|
||||||
window.addEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false);
|
document.addEventListener(sv.kEVENT_TYPE_BEFORE_TOOLBAR_CUSTOMIZATION, listener, false);
|
||||||
window.addEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false);
|
document.addEventListener(sv.kEVENT_TYPE_AFTER_TOOLBAR_CUSTOMIZATION, listener, false);
|
||||||
window.addEventListener('unload', listener, true);
|
document.addEventListener('unload', listener, false);
|
||||||
tabbarToolboxes.forEach(function(aToolbox) {
|
tabbarToolboxes.forEach(function(aToolbox) {
|
||||||
if (!aToolbox.firstChild.hasChildNodes())
|
if (!aToolbox.firstChild.hasChildNodes())
|
||||||
aToolbox.setAttribute('collapsed', true);
|
aToolbox.setAttribute('collapsed', true);
|
||||||
@ -1314,14 +1313,14 @@ TreeStyleTabWindowHelper.overrideExtensionsDelayed = function TSTWH_overrideExte
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case 'unload':
|
case 'unload':
|
||||||
window.removeEventListener('TabOpen', this, true);
|
document.removeEventListener('TabOpen', this, true);
|
||||||
window.removeEventListener('unload', this, true);
|
document.removeEventListener('unload', this, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener('TabOpen', listener, true);
|
document.addEventListener('TabOpen', listener, true);
|
||||||
window.addEventListener('unload', listener, true);
|
document.addEventListener('unload', listener, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user