Skip to content

Commit 2d66624

Browse files
author
Cristian Tuns
committed
Backed out changeset ecd780688279 (bug 1875100) for causing mochitest failures in test_suspend_media_by_inactive_docshell.html
1 parent 657bc8f commit 2d66624

File tree

17 files changed

+73
-227
lines changed

17 files changed

+73
-227
lines changed

browser/base/content/tabbrowser.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2094,6 +2094,7 @@
20942094
uriIsAboutBlank,
20952095
userContextId,
20962096
skipLoad,
2097+
initiallyActive,
20972098
} = {}) {
20982099
let b = document.createXULElement("browser");
20992100
// Use the JSM global to create the permanentKey, so that if the
@@ -2119,7 +2120,6 @@
21192120
messagemanagergroup: "browsers",
21202121
tooltip: "aHTMLTooltip",
21212122
type: "content",
2122-
manualactiveness: "true",
21232123
};
21242124
for (let attribute in defaultBrowserAttributes) {
21252125
b.setAttribute(attribute, defaultBrowserAttributes[attribute]);
@@ -2129,6 +2129,10 @@
21292129
b.setAttribute("maychangeremoteness", "true");
21302130
}
21312131

2132+
if (!initiallyActive) {
2133+
b.setAttribute("initiallyactive", "false");
2134+
}
2135+
21322136
if (userContextId) {
21332137
b.setAttribute("usercontextid", userContextId);
21342138
}

browser/base/content/test/fullscreen/FullscreenFrame.sys.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export class FullscreenFrameChild extends JSWindowActorChild {
4343
case "ExitFullscreen":
4444
return this.contentWindow.document.exitFullscreen();
4545
case "RequestFullscreen":
46+
this.browsingContext.isActive = true;
4647
return Promise.all([this.changed(), this.requestFullscreen()]);
4748
case "CreateChild":
4849
let child = msg.data;

browser/components/extensions/test/browser/browser.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,6 @@ skip-if = [
307307
"verify && !debug && os == 'mac'",
308308
]
309309

310-
["browser_ext_optionsPage_activity.js"]
311-
312310
["browser_ext_optionsPage_browser_style.js"]
313311

314312
["browser_ext_optionsPage_links_open_in_tabs.js"]

browser/components/extensions/test/browser/browser_ext_optionsPage_activity.js

Lines changed: 0 additions & 79 deletions
This file was deleted.

browser/components/shopping/ShoppingSidebarParent.sys.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,11 @@ class ShoppingSidebarManagerClass {
341341
if (!sidebar) {
342342
return;
343343
}
344+
let { browsingContext } = sidebar.querySelector("browser");
344345
try {
345346
// Tell Gecko when the sidebar visibility changes to avoid background
346347
// sidebars taking more CPU / energy than needed.
347-
sidebar.querySelector("browser").docShellIsActive =
348+
browsingContext.isActive =
348349
!document.hidden &&
349350
aBrowser == gBrowser.selectedBrowser &&
350351
!sidebar.hidden;

browser/components/shopping/content/shopping-sidebar.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
disablehistory="true"
2323
flex="1"
2424
message="true"
25-
manualactiveness="true"
2625
remoteType="privilegedabout"
2726
maychangeremoteness="true"
2827
remote="true"

docshell/base/BrowsingContext.cpp

Lines changed: 38 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,15 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
422422

423423
fields.Get<IDX_HistoryID>() = nsID::GenerateUUID();
424424
fields.Get<IDX_ExplicitActive>() = [&] {
425-
if (parentBC || aType == Type::Content) {
425+
if (parentBC) {
426426
// Non-root browsing-contexts inherit their status from its parent.
427-
// Top-content either gets managed by the top chrome, or gets manually
428-
// managed by the front-end (see ManuallyManagesActiveness). In any case
429-
// we want to start off as inactive.
430427
return ExplicitActiveStatus::None;
431428
}
429+
if (aType == Type::Content) {
430+
// Content gets managed by the chrome front-end / embedder element and
431+
// starts as inactive.
432+
return ExplicitActiveStatus::Inactive;
433+
}
432434
// Chrome starts as active.
433435
return ExplicitActiveStatus::Active;
434436
}();
@@ -737,24 +739,21 @@ void BrowsingContext::SetEmbedderElement(Element* aEmbedder) {
737739
txn.SetEmbedderInnerWindowId(inner->WindowID());
738740
}
739741
txn.SetFullscreenAllowedByOwner(OwnerAllowsFullscreen(*aEmbedder));
740-
if (XRE_IsParentProcess() && aEmbedder->IsXULElement() && IsTopContent()) {
742+
if (XRE_IsParentProcess() && IsTopContent()) {
741743
nsAutoString messageManagerGroup;
742-
aEmbedder->GetAttr(nsGkAtoms::messagemanagergroup, messageManagerGroup);
743-
txn.SetMessageManagerGroup(messageManagerGroup);
744-
txn.SetUseGlobalHistory(
745-
!aEmbedder->HasAttr(nsGkAtoms::disableglobalhistory));
746-
if (!aEmbedder->HasAttr(nsGkAtoms::manualactiveness)) {
747-
// We're active iff the parent cross-chrome-boundary is active. Note we
748-
// can't just use this->Canonical()->GetParentCrossChromeBoundary here,
749-
// since mEmbedderElement is still null at this point.
750-
RefPtr bc = aEmbedder->OwnerDoc()->GetBrowsingContext();
751-
const bool isActive = bc && bc->IsActive();
752-
txn.SetExplicitActive(isActive ? ExplicitActiveStatus::Active
753-
: ExplicitActiveStatus::Inactive);
754-
if (auto* bp = Canonical()->GetBrowserParent()) {
755-
bp->SetRenderLayers(isActive);
744+
if (aEmbedder->IsXULElement()) {
745+
aEmbedder->GetAttr(nsGkAtoms::messagemanagergroup, messageManagerGroup);
746+
if (!aEmbedder->AttrValueIs(kNameSpaceID_None,
747+
nsGkAtoms::initiallyactive,
748+
nsGkAtoms::_false, eIgnoreCase)) {
749+
txn.SetExplicitActive(ExplicitActiveStatus::Active);
756750
}
757751
}
752+
txn.SetMessageManagerGroup(messageManagerGroup);
753+
754+
bool useGlobalHistory =
755+
!aEmbedder->HasAttr(nsGkAtoms::disableglobalhistory);
756+
txn.SetUseGlobalHistory(useGlobalHistory);
758757
}
759758

760759
MOZ_ALWAYS_SUCCEEDS(txn.Commit(this));
@@ -2635,16 +2634,8 @@ void BrowsingContext::DidSet(FieldIndex<IDX_GVInaudibleAutoplayRequestStatus>) {
26352634
"browsing context");
26362635
}
26372636

2638-
bool BrowsingContext::CanSet(FieldIndex<IDX_ExplicitActive>,
2639-
const ExplicitActiveStatus&,
2640-
ContentParent* aSource) {
2641-
return XRE_IsParentProcess() && IsTop() && !aSource;
2642-
}
2643-
26442637
void BrowsingContext::DidSet(FieldIndex<IDX_ExplicitActive>,
26452638
ExplicitActiveStatus aOldValue) {
2646-
MOZ_ASSERT(IsTop());
2647-
26482639
const bool isActive = IsActive();
26492640
const bool wasActive = [&] {
26502641
if (aOldValue != ExplicitActiveStatus::None) {
@@ -2657,43 +2648,32 @@ void BrowsingContext::DidSet(FieldIndex<IDX_ExplicitActive>,
26572648
return;
26582649
}
26592650

2660-
Group()->UpdateToplevelsSuspendedIfNeeded();
2661-
if (XRE_IsParentProcess()) {
2662-
if (BrowserParent* bp = Canonical()->GetBrowserParent()) {
2663-
bp->RecomputeProcessPriority();
2651+
if (IsTop()) {
2652+
Group()->UpdateToplevelsSuspendedIfNeeded();
2653+
2654+
if (XRE_IsParentProcess()) {
2655+
auto* bc = Canonical();
2656+
if (BrowserParent* bp = bc->GetBrowserParent()) {
2657+
bp->RecomputeProcessPriority();
26642658
#if defined(XP_WIN) && defined(ACCESSIBILITY)
2665-
if (a11y::Compatibility::IsDolphin()) {
2666-
// update active accessible documents on windows
2667-
if (a11y::DocAccessibleParent* tabDoc =
2668-
bp->GetTopLevelDocAccessible()) {
2669-
HWND window = tabDoc->GetEmulatedWindowHandle();
2670-
MOZ_ASSERT(window);
2671-
if (window) {
2672-
if (isActive) {
2673-
a11y::nsWinUtils::ShowNativeWindow(window);
2674-
} else {
2675-
a11y::nsWinUtils::HideNativeWindow(window);
2659+
if (a11y::Compatibility::IsDolphin()) {
2660+
// update active accessible documents on windows
2661+
if (a11y::DocAccessibleParent* tabDoc =
2662+
bp->GetTopLevelDocAccessible()) {
2663+
HWND window = tabDoc->GetEmulatedWindowHandle();
2664+
MOZ_ASSERT(window);
2665+
if (window) {
2666+
if (isActive) {
2667+
a11y::nsWinUtils::ShowNativeWindow(window);
2668+
} else {
2669+
a11y::nsWinUtils::HideNativeWindow(window);
2670+
}
26762671
}
26772672
}
26782673
}
2679-
}
26802674
#endif
2681-
}
2682-
2683-
// NOTE(emilio): Ideally we'd want to reuse the ExplicitActiveStatus::None
2684-
// set-up, but that's non-trivial to do because in content processes we
2685-
// can't access the top-cross-chrome-boundary bc.
2686-
auto manageTopDescendant = [&](auto* aChild) {
2687-
if (!aChild->ManuallyManagesActiveness()) {
2688-
aChild->SetIsActiveInternal(isActive, IgnoreErrors());
2689-
if (BrowserParent* bp = aChild->GetBrowserParent()) {
2690-
bp->SetRenderLayers(isActive);
2691-
}
26922675
}
2693-
return CallState::Continue;
2694-
};
2695-
Canonical()->CallOnAllTopDescendants(manageTopDescendant,
2696-
/* aIncludeNestedBrowsers = */ false);
2676+
}
26972677
}
26982678

26992679
PreOrderWalk([&](BrowsingContext* aContext) {

docshell/base/BrowsingContext.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,12 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
606606
}
607607

608608
bool IsActive() const;
609+
void SetIsActive(bool aIsActive, mozilla::ErrorResult& aRv) {
610+
SetExplicitActive(aIsActive ? ExplicitActiveStatus::Active
611+
: ExplicitActiveStatus::Inactive,
612+
aRv);
613+
}
614+
609615
bool ForceOffline() const { return GetForceOffline(); }
610616

611617
bool ForceDesktopViewport() const { return GetForceDesktopViewport(); }
@@ -1109,8 +1115,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
11091115

11101116
void DidSet(FieldIndex<IDX_DisplayMode>, enum DisplayMode aOldValue);
11111117

1112-
bool CanSet(FieldIndex<IDX_ExplicitActive>, const ExplicitActiveStatus&,
1113-
ContentParent* aSource);
11141118
void DidSet(FieldIndex<IDX_ExplicitActive>, ExplicitActiveStatus aOldValue);
11151119

11161120
bool CanSet(FieldIndex<IDX_IsActiveBrowserWindowInternal>, const bool& aValue,

0 commit comments

Comments
 (0)