Bug 1673683 - Copy activeness status in CanonicalBrowsingContext::ReplacedBy, instead of handling it on consumers. r=nika,agi

Differential Revision: https://phabricator.services.mozilla.com/D102220
This commit is contained in:
Emilio Cobos Álvarez 2021-01-20 15:09:09 +00:00
parent c10e4bec55
commit cd99d52bde
3 changed files with 12 additions and 15 deletions

View File

@ -1876,10 +1876,11 @@
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.
// This shouldn't really be necessary (it should always set the same
// value as activeness is correctly preserved across remoteness changes).
// However, this has the side effect of sending MozLayerTreeReady /
// MozLayerTreeCleared events for remote frames, which the tab switcher
// depends on.
aBrowser.docShellIsActive = this.shouldActivateDocShell(aBrowser);
// Create a new tab progress listener for the new browser we just injected,
@ -5695,10 +5696,11 @@
browser.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.
// This shouldn't really be necessary (it should always set the same
// value as activeness is correctly preserved across remoteness changes).
// However, this has the side effect of sending MozLayerTreeReady /
// MozLayerTreeCleared events for remote frames, which the tab switcher
// depends on.
browser.docShellIsActive = this.shouldActivateDocShell(browser);
// Create a new tab progress listener for the new browser we just

View File

@ -167,6 +167,8 @@ void CanonicalBrowsingContext::ReplacedBy(
aNewContext->mWebProgress = std::move(mWebProgress);
aNewContext->mFields.SetWithoutSyncing<IDX_BrowserId>(GetBrowserId());
aNewContext->mFields.SetWithoutSyncing<IDX_HistoryID>(GetHistoryID());
aNewContext->mFields.SetWithoutSyncing<IDX_ExplicitActive>(
GetExplicitActive());
if (mSessionHistory) {
mSessionHistory->SetBrowsingContext(aNewContext);

View File

@ -172,18 +172,11 @@ 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();