diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 1d9f5eeb2ae8..652f6a2741ae 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -1864,6 +1864,12 @@ aBrowser.droppedLinkHandler = oldDroppedLinkHandler; + // Switching a browser's remoteness will create a new frameLoader. + // As frameLoaders start out with an active docShell we have to + // deactivate it if this is not the selected tab's browser or the + // browser window is minimized. + aBrowser.docShellIsActive = this.shouldActivateDocShell(aBrowser); + // Create a new tab progress listener for the new browser we just injected, // since tab progress listeners have logic for handling the initial about:blank // load diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp index 7f01ff6cf8af..7c536a54ed5b 100644 --- a/docshell/base/CanonicalBrowsingContext.cpp +++ b/docshell/base/CanonicalBrowsingContext.cpp @@ -167,8 +167,6 @@ void CanonicalBrowsingContext::ReplacedBy( aNewContext->mWebProgress = std::move(mWebProgress); aNewContext->mFields.SetWithoutSyncing(GetBrowserId()); aNewContext->mFields.SetWithoutSyncing(GetHistoryID()); - aNewContext->mFields.SetWithoutSyncing( - GetExplicitActive()); if (mSessionHistory) { mSessionHistory->SetBrowsingContext(aNewContext); diff --git a/mobile/android/chrome/geckoview/geckoview.js b/mobile/android/chrome/geckoview/geckoview.js index c84143d271d7..a5fa8d174709 100644 --- a/mobile/android/chrome/geckoview/geckoview.js +++ b/mobile/android/chrome/geckoview/geckoview.js @@ -182,11 +182,18 @@ var ModuleManager = { this.forEach(module => { module.onDestroyBrowser(); }); + + // TODO: Bug 1673683: `docShellIsActive` is sometimes not preserved when + // switching process. + this.docShellIsActiveWhileSwitchingProcess = this.browser.docShellIsActive; }, didChangeBrowserRemoteness() { debug`DidChangeBrowserRemoteness`; + this.browser.docShellIsActive = this.docShellIsActiveWhileSwitchingProcess; + this.docShellIsActiveWhileSwitchingProcess = undefined; + this.forEach(module => { if (module.impl) { module.impl.onInitBrowser();