Bug 1940688 - Add a pref to make top level pages always active for the purpose of refresh driver throttling and such. r=layout-reviewers,tnikkel

Differential Revision: https://phabricator.services.mozilla.com/D233937
This commit is contained in:
Emilio Cobos Álvarez
2025-01-15 20:43:02 +00:00
parent 3c1b64acfe
commit e2b1d953d0
3 changed files with 16 additions and 1 deletions

View File

@@ -11246,6 +11246,12 @@ bool PresShell::ComputeActiveness() const {
MOZ_LOG(gLog, LogLevel::Debug,
(" > BrowsingContext %p active: %d", bc, inActiveTab));
if (StaticPrefs::layout_testing_top_level_always_active() && bc &&
bc->IsTop()) {
MOZ_LOG(gLog, LogLevel::Debug, (" > Activeness overridden by pref"));
return true;
}
Document* root = nsContentUtils::GetInProcessSubtreeRootDocument(doc);
if (auto* browserChild = BrowserChild::GetFrom(root->GetDocShell())) {
// We might want to activate a tab even though the browsing-context is not