summaryrefslogtreecommitdiffstats
path: root/dom/base/test/fullscreen/file_fullscreen-lenient-setters.html
blob: 02491c177e6f3a5b2df8d72a9c72f5a9fc02ab19 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Test for Bug 1268798</title>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<script>
"use strict";

function ok(condition, msg) {
  opener.ok(condition, "[lenient-setters] " + msg);
}

function is(a, b, msg) {
  opener.is(a, b, "[lenient-setters] " + msg);
}

function info(msg) {
  opener.info("[lenient-setters] " + msg);
}

let unattachedDiv = document.createElement("div");

function begin() {
  var originalValue = document.fullscreen;
  try {
    document.fullscreen = !document.fullscreen;
    is(document.fullscreen, originalValue,
       "fullscreen should not be changed");
  } catch (e) {
    ok(false, "Setting fullscreen should not throw");
  }

  var originalElem = document.fullscreenElement;
  try {
    document.fullscreenElement = unattachedDiv;
    document.fullscreenElement = [];
    is(document.fullscreenElement, originalElem,
       "fullscreenElement should not be changed");
  } catch (e) {
    ok(false, "Setting fullscreenElement should not throw");
  }

  var originalEnabled = document.fullscreenEnabled;
  try {
    document.fullscreenEnabled = !originalEnabled;
    is(document.fullscreenEnabled, originalEnabled,
       "fullscreenEnabled should not be changed");
  } catch (e) {
    ok(false, "Setting fullscreenEnabled should not throw");
  }

  opener.nextTest();
}

</script>
</body>
</html>