Remove registered event listeners more completely
This commit is contained in:
parent
991390d88f
commit
4b32a22531
@ -1654,13 +1654,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
// We always have to re-create splitter, because its "collapse"
|
// We always have to re-create splitter, because its "collapse"
|
||||||
// behavior becomes broken by repositioning of the tab bar.
|
// behavior becomes broken by repositioning of the tab bar.
|
||||||
if (splitter) {
|
if (splitter) {
|
||||||
try {
|
this._destroyOldSplitter();
|
||||||
splitter.removeEventListener('mousedown', this.windowService, false);
|
|
||||||
splitter.removeEventListener('mouseup', this.windowService, false);
|
|
||||||
splitter.removeEventListener('dblclick', this.windowService, false);
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
}
|
|
||||||
let oldSplitter = splitter;
|
let oldSplitter = splitter;
|
||||||
splitter = oldSplitter.cloneNode(true);
|
splitter = oldSplitter.cloneNode(true);
|
||||||
oldSplitter.parentNode.removeChild(oldSplitter);
|
oldSplitter.parentNode.removeChild(oldSplitter);
|
||||||
@ -1689,13 +1683,14 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
// So, we have to turn the actual tab bar visible manually
|
// So, we have to turn the actual tab bar visible manually
|
||||||
// when the grippy is clicked.
|
// when the grippy is clicked.
|
||||||
let tabContainer = this.mTabBrowser.tabContainer;
|
let tabContainer = this.mTabBrowser.tabContainer;
|
||||||
grippy.addEventListener('click', function() {
|
let grippyOnClick = function() {
|
||||||
tabContainer.ownerDocument.defaultView.setTimeout(function() {
|
tabContainer.ownerDocument.defaultView.setTimeout(function() {
|
||||||
var visible = grippy.getAttribute('state') != 'collapsed';
|
var visible = grippy.getAttribute('state') != 'collapsed';
|
||||||
if (visible != tabContainer.visible)
|
if (visible != tabContainer.visible)
|
||||||
tabContainer.visible = visible;
|
tabContainer.visible = visible;
|
||||||
}, 0);
|
}, 0);
|
||||||
}, true);
|
};
|
||||||
|
grippy.addEventListener('click', grippy.grippyOnClick, true);
|
||||||
splitter.appendChild(grippy);
|
splitter.appendChild(grippy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1711,9 +1706,26 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
var ref = this.mTabBrowser.mPanelContainer;
|
var ref = this.mTabBrowser.mPanelContainer;
|
||||||
ref.parentNode.insertBefore(splitter, ref);
|
ref.parentNode.insertBefore(splitter, ref);
|
||||||
|
|
||||||
|
this.splitter = splitter;
|
||||||
return splitter;
|
return splitter;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_destroyOldSplitter : function TSTBrowser_destroyOldSplitter(aChanging, aOldPosition, aNewPosition)
|
||||||
|
{
|
||||||
|
var d = this.document;
|
||||||
|
var splitter = this.splitter;
|
||||||
|
try {
|
||||||
|
splitter.removeEventListener('mousedown', this.windowService, false);
|
||||||
|
splitter.removeEventListener('mouseup', this.windowService, false);
|
||||||
|
splitter.removeEventListener('dblclick', this.windowService, false);
|
||||||
|
var grippy = splitter.firstChild;
|
||||||
|
grippy.removeEventListener('click', grippy.grippyOnClick, true);
|
||||||
|
delete grippy.grippyOnClick;
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
fireTabbarPositionEvent : function TSTBrowser_fireTabbarPositionEvent(aChanging, aOldPosition, aNewPosition)
|
fireTabbarPositionEvent : function TSTBrowser_fireTabbarPositionEvent(aChanging, aOldPosition, aNewPosition)
|
||||||
{
|
{
|
||||||
if (aOldPosition == aNewPosition)
|
if (aOldPosition == aNewPosition)
|
||||||
@ -2209,9 +2221,6 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
delete this.timers[key];
|
delete this.timers[key];
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.autoHide.destroy();
|
|
||||||
delete this._autoHide;
|
|
||||||
|
|
||||||
this._initDNDObservers(); // ensure initialized
|
this._initDNDObservers(); // ensure initialized
|
||||||
this.tabbarDNDObserver.destroy();
|
this.tabbarDNDObserver.destroy();
|
||||||
delete this._tabbarDNDObserver;
|
delete this._tabbarDNDObserver;
|
||||||
@ -2228,6 +2237,8 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
delete this.tabStripPlaceHolderBoxObserver;
|
delete this.tabStripPlaceHolderBoxObserver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._destroyOldSplitter();
|
||||||
|
|
||||||
var w = this.window;
|
var w = this.window;
|
||||||
var d = this.document;
|
var d = this.document;
|
||||||
var b = this.mTabBrowser;
|
var b = this.mTabBrowser;
|
||||||
@ -2244,6 +2255,9 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
|
|
||||||
this._endListenTabbarEvents();
|
this._endListenTabbarEvents();
|
||||||
|
|
||||||
|
this.autoHide.destroy();
|
||||||
|
this._autoHide = undefined; // block to be re-initialized by property accesses
|
||||||
|
|
||||||
w.removeEventListener('resize', this, true);
|
w.removeEventListener('resize', this, true);
|
||||||
w.removeEventListener('beforecustomization', this, true);
|
w.removeEventListener('beforecustomization', this, true);
|
||||||
w.removeEventListener('aftercustomization', this, false);
|
w.removeEventListener('aftercustomization', this, false);
|
||||||
@ -6922,7 +6936,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
/* show/hide tab bar */
|
/* show/hide tab bar */
|
||||||
get autoHide()
|
get autoHide()
|
||||||
{
|
{
|
||||||
if (!this._autoHide) {
|
if (!('_autoHide' in this)) {
|
||||||
this._autoHide = new AutoHideBrowser(this.mTabBrowser);
|
this._autoHide = new AutoHideBrowser(this.mTabBrowser);
|
||||||
}
|
}
|
||||||
return this._autoHide;
|
return this._autoHide;
|
||||||
|
@ -316,7 +316,7 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
|
|||||||
|
|
||||||
get autoHideWindow()
|
get autoHideWindow()
|
||||||
{
|
{
|
||||||
if (!this._autoHideWindow) {
|
if (!('_autoHideWindow' in this)) {
|
||||||
this._autoHideWindow = new AutoHideWindow(this.window);
|
this._autoHideWindow = new AutoHideWindow(this.window);
|
||||||
}
|
}
|
||||||
return this._autoHideWindow;
|
return this._autoHideWindow;
|
||||||
@ -324,7 +324,7 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
|
|||||||
|
|
||||||
get themeManager()
|
get themeManager()
|
||||||
{
|
{
|
||||||
if (!this._themeManager) {
|
if (!('_themeManager' in this)) {
|
||||||
this._themeManager = new TreeStyleTabThemeManager(this.window);
|
this._themeManager = new TreeStyleTabThemeManager(this.window);
|
||||||
}
|
}
|
||||||
return this._themeManager;
|
return this._themeManager;
|
||||||
@ -544,10 +544,10 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
|
|||||||
w.removeEventListener('unload', this, false);
|
w.removeEventListener('unload', this, false);
|
||||||
|
|
||||||
this.autoHideWindow.destroy();
|
this.autoHideWindow.destroy();
|
||||||
delete this._autoHideWindow;
|
this._autoHideWindow = undefined;
|
||||||
|
|
||||||
this.themeManager.destroy();
|
this.themeManager.destroy();
|
||||||
delete this._themeManager;
|
this._themeManager = undefined;
|
||||||
|
|
||||||
this.browser.treeStyleTab.saveCurrentState();
|
this.browser.treeStyleTab.saveCurrentState();
|
||||||
this.destroyTabBrowser(this.browser);
|
this.destroyTabBrowser(this.browser);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user