summaryrefslogtreecommitdiffstats
path: root/dom/base/test/fullscreen/file_fullscreen-event-order.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /dom/base/test/fullscreen/file_fullscreen-event-order.html
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/test/fullscreen/file_fullscreen-event-order.html')
-rw-r--r--dom/base/test/fullscreen/file_fullscreen-event-order.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/dom/base/test/fullscreen/file_fullscreen-event-order.html b/dom/base/test/fullscreen/file_fullscreen-event-order.html
new file mode 100644
index 0000000000..72fb2c9b47
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-event-order.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="file_fullscreen-utils.js"></script>
+<iframe src="empty.html" allowfullscreen></iframe>
+<script>
+function ok(condition, msg) {
+ opener.ok(condition, "[event-order] " + msg);
+}
+function is(a, b, msg) {
+ opener.is(a, b, "[event-order] " + msg);
+}
+
+let fullscreenEvents = [];
+let iframe, iframeDoc;
+
+function begin() {
+ iframe = document.querySelector("iframe");
+ iframeDoc = iframe.contentDocument;
+ document.addEventListener("fullscreenchange", evt => {
+ fullscreenEvents.push(evt);
+ });
+ iframeDoc.addEventListener("fullscreenchange", evt => {
+ fullscreenEvents.push(evt);
+ });
+ addFullscreenChangeContinuation("enter", enterFullscreen);
+ iframeDoc.body.requestFullscreen();
+}
+
+function assertFullscreenEvents(action) {
+ is(fullscreenEvents.length, 2,
+ "Two documents should have event dispatched for " + action);
+ is(fullscreenEvents[0].target, iframe,
+ "Root document should have the event dispatched first after " + action);
+ is(fullscreenEvents[1].target, iframeDoc.body,
+ "Inner document should have the event dispatched second after " + action);
+}
+
+function enterFullscreen() {
+ assertFullscreenEvents("requestFullscreen");
+ fullscreenEvents = [];
+ addFullscreenChangeContinuation("exit", exitFullscreen);
+ document.exitFullscreen();
+}
+
+function exitFullscreen() {
+ assertFullscreenEvents("exitFullscreen");
+ opener.nextTest();
+}
+</script>