commit 9c4f751aaaae6bb14d8491b2b98db87995efeef1
parent 6eed70821ee6c71d34917751fc406fe9a65a5c9f
Author: Simon Farre <simon.farre.cx@gmail.com>
Date: Mon, 15 Dec 2025 08:06:44 +0000
Bug 1965700 - Don't dispatch duplicate events r=edgar
Check if parent document's fullscreen element is the "container" of this
document, and break.
If we have documents in fullscreen A[B(el)] already, and we add A[B(el,
el2)], only 1 fullscreen change event should be sent, and that's to B,
not to A, because A does not have any fullscreen changes, it's
fullscreen element remains the same - the iframe for B.
Differential Revision: https://phabricator.services.mozilla.com/D248713
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp
@@ -16732,6 +16732,12 @@ bool Document::ApplyFullscreen(UniquePtr<FullscreenRequest> aRequest) {
}
Document* parent = child->GetInProcessParentDocument();
+
+ // If this is true, nothing above this node will have changed, stopping here
+ // prevents us from sending duplicate events.
+ if (parent->GetUnretargetedFullscreenElement() == element) {
+ break;
+ }
parent->SetFullscreenElement(*element);
changed.AppendElement(parent);
child = parent;
diff --git a/testing/web-platform/meta/fullscreen/api/document-exit-fullscreen-nested-in-iframe.html.ini b/testing/web-platform/meta/fullscreen/api/document-exit-fullscreen-nested-in-iframe.html.ini
@@ -1,3 +0,0 @@
-[document-exit-fullscreen-nested-in-iframe.html]
- [Exit fullscreen for nested fullscreen inside an iframe]
- expected: FAIL