Bug 1646561 - Stop using DocShell::GetVisibility in nsFocusManager. r=emilio,mconley

We stop checking for the tab state to be `STATE_LOADED` since it
messes up initial focus. Instead, we directly check if the tab
is warming, since that was the intention of this check, AFAICT.
See Bug 1397426 for where this was introduced.

Differential Revision: https://phabricator.services.mozilla.com/D108452
This commit is contained in:
Steven MacLeod
2021-03-16 15:36:55 +00:00
parent 750a8d4fcc
commit 42f60aa4ee
2 changed files with 4 additions and 12 deletions

View File

@@ -476,9 +476,9 @@ class AsyncTabSwitcher {
this.noteMakingTabVisibleWithoutLayers();
}
this.maybeActivateDocShell(this.requestedTab);
this.tabbrowser._adjustFocusAfterTabSwitch(showTab);
this.window.gURLBar.afterTabSwitchFocusChange();
this.maybeActivateDocShell(this.requestedTab);
}
}
@@ -538,14 +538,13 @@ class AsyncTabSwitcher {
// the loaded state, but the DocShell is still not yet active, we
// should activate it.
let browser = tab.linkedBrowser;
let state = this.getTabState(tab);
let canCheckDocShellState =
!browser.mDestroyed &&
(browser.docShell || browser.frameLoader.remoteTab);
if (
tab == this.requestedTab &&
canCheckDocShellState &&
state == this.STATE_LOADED &&
!this.warmingTabs.has(tab) &&
!browser.docShellIsActive &&
!this.minimizedOrFullyOccluded
) {