summaryrefslogtreecommitdiffstats
path: root/dom/base/test/fullscreen/file_fullscreen-focus.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/base/test/fullscreen/file_fullscreen-focus.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/test/fullscreen/file_fullscreen-focus.html')
-rw-r--r--dom/base/test/fullscreen/file_fullscreen-focus.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/dom/base/test/fullscreen/file_fullscreen-focus.html b/dom/base/test/fullscreen/file_fullscreen-focus.html
new file mode 100644
index 0000000000..be91025f45
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-focus.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+
+Test that a fullscreen request fails if the window is not focused.
+
+Open window1, open window2, focus window2, and then attempt to fullscreen
+window1 while it is not focused. The fullscreen attempt should be rejected
+because the window is not focused.
+
+-->
+<head>
+ <title>Test fullscreen request is blocked when window is not focused</title>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="file_fullscreen-utils.js"></script>
+</head>
+<body>
+
+<script type="application/javascript">
+
+function ok(condition, msg) {
+ opener.ok(condition, "[focus] " + msg);
+}
+
+var window1, window2;
+
+function openWindow() {
+ var w = window.open("file_fullscreen-focus-inner.html", "",
+ "width=500,height=500");
+ return w;
+}
+
+function begin() {
+ window1 = openWindow();
+ window1.focus();
+
+ SimpleTest.waitForFocus(function(){
+ window2 = openWindow();
+ window2.focus();
+
+ SimpleTest.waitForFocus(function(){
+ // Now that window2 is focused, attempt to fullscreen window1.
+ // This should fail.
+ window1.enterFullscreen("one");
+ }, window2);
+
+ }, window1);
+}
+
+async function enteredFullscreen(enteredSuccessfully) {
+ ok(!enteredSuccessfully, "window1 did not enter fullscreen");
+
+ if (enteredSuccessfully) {
+ await window1.document.exitFullscreen()
+ }
+
+ window1.close();
+ window2.close();
+ opener.nextTest();
+}
+
+</script>
+</pre>
+<div id="full-screen-element"></div>
+</body>
+</html>