summaryrefslogtreecommitdiffstats
path: root/dom/base/test/fullscreen/file_fullscreen-featurePolicy-inner.html
blob: 844684b0545613f19ae48c4e01f0920ac6f475f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body onload="doRequestFullscreen()">
<script>
function doRequestFullscreen() {
  let isChrome = location.search.includes("chrome");

  function handler(evt) {
    document.removeEventListener("fullscreenchange", handler);
    document.removeEventListener("fullscreenerror", handler);
    const enabled = isChrome ? SpecialPowers.wrap(document).fullscreenEnabled
                             : document.fullscreenEnabled;
    if (evt.type == "fullscreenchange") {
      document.addEventListener("fullscreenchange", () => parent.continueTest(evt.type, enabled), {once: true});
      document.exitFullscreen();
    } else {
      parent.continueTest(evt.type, enabled);
    }
  }
  document.addEventListener("fullscreenchange", handler);
  document.addEventListener("fullscreenerror", handler);
  parent.opener.info("Requesting fullscreen");
  if (isChrome) {
    SpecialPowers.wrap(document.documentElement).requestFullscreen();
  } else {
    document.documentElement.requestFullscreen();
  }
}
</script>
</body>
</html>