diff --git a/browser/base/content/tabbrowser-tab.js b/browser/base/content/tabbrowser-tab.js index e739b3adf284..28577d2739a1 100644 --- a/browser/base/content/tabbrowser-tab.js +++ b/browser/base/content/tabbrowser-tab.js @@ -57,6 +57,7 @@ this.addEventListener("focus", this); this.addEventListener("AriaFocus", this); + this._hover = false; this._selectedOnFirstMouseDown = false; /** @@ -488,15 +489,11 @@ if (this.hidden || this.closing) { return; } - - let tabContainer = this.container; + this._hover = true; if (this.selected) { - tabContainer._handleTabSelect(); - } - - tabContainer._hoveredTab = this; - if (this.linkedPanel && !this.selected) { + this.container._handleTabSelect(); + } else if (this.linkedPanel) { this.linkedBrowser.unselectedTabHover(true); this.startUnselectedTabHoverTimer(); } @@ -512,7 +509,10 @@ } _mouseleave() { - this.container._hoveredTab = null; + if (!this._hover) { + return; + } + this._hover = false; if (this.linkedPanel && !this.selected) { this.linkedBrowser.unselectedTabHover(false); this.cancelUnselectedTabHoverTimer(); diff --git a/browser/base/content/tabbrowser-tabs.js b/browser/base/content/tabbrowser-tabs.js index 34fac9d58568..adb0b905af24 100644 --- a/browser/base/content/tabbrowser-tabs.js +++ b/browser/base/content/tabbrowser-tabs.js @@ -38,7 +38,6 @@ this.baseConnect(); - this._hoveredTab = null; this._blockDblClick = false; this._tabDropIndicator = this.querySelector(".tab-drop-indicator"); this._dragOverDelay = 350; diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 81454b28615e..ef054d1174da 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -3973,9 +3973,7 @@ this._invalidateCachedTabs(); // Invalidate hovered tab state tracking for this closing tab. - if (this.tabContainer._hoveredTab == aTab) { - aTab._mouseleave(); - } + aTab._mouseleave(); if (newTab) { this.addTrustedTab(BROWSER_NEW_TAB_URL, {