summaryrefslogtreecommitdiffstats
path: root/dom/ipc/WindowGlobalParent.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:12:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:12:12 +0000
commita7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431 (patch)
tree54617b4f5f04ee87a2c9e3b97cc88b8626859124 /dom/ipc/WindowGlobalParent.cpp
parentReleasing progress-linux version 115.7.0esr-1~deb12u1progress7u1. (diff)
downloadfirefox-esr-a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431.tar.xz
firefox-esr-a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431.zip
Merging upstream version 115.8.0esr.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/ipc/WindowGlobalParent.cpp')
-rw-r--r--dom/ipc/WindowGlobalParent.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/dom/ipc/WindowGlobalParent.cpp b/dom/ipc/WindowGlobalParent.cpp
index 0e345e9107..c1fc607634 100644
--- a/dom/ipc/WindowGlobalParent.cpp
+++ b/dom/ipc/WindowGlobalParent.cpp
@@ -609,6 +609,23 @@ bool WindowGlobalParent::IsCurrentGlobal() {
return CanSend() && BrowsingContext()->GetCurrentWindowGlobal() == this;
}
+bool WindowGlobalParent::IsActiveInTab() {
+ if (!CanSend()) {
+ return false;
+ }
+
+ CanonicalBrowsingContext* bc = BrowsingContext();
+ if (!bc || bc->GetCurrentWindowGlobal() != this) {
+ return false;
+ }
+
+ // We check the top BC so we don't need to worry about getting a stale value.
+ // That may not be necessary.
+ MOZ_ASSERT(bc->Top()->IsInBFCache() == bc->IsInBFCache(),
+ "BFCache bit out of sync?");
+ return bc->AncestorsAreCurrent() && !bc->Top()->IsInBFCache();
+}
+
namespace {
class ShareHandler final : public PromiseNativeHandler {