File: iframe-allowfullscreen.html

package info (click to toggle)
firefox-esr 52.8.1esr-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 1,983,244 kB
  • sloc: cpp: 4,810,275; ansic: 2,004,548; python: 451,282; java: 241,615; asm: 178,649; xml: 136,302; sh: 82,207; makefile: 22,575; perl: 15,783; objc: 4,389; yacc: 1,816; ada: 1,697; pascal: 1,519; lex: 1,257; cs: 879; exp: 499; php: 436; lisp: 258; awk: 152; sed: 51; ruby: 47; csh: 27
file content (55 lines) | stat: -rw-r--r-- 2,479 bytes parent folder | download | duplicates (6)
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
<!doctype html>
<meta charset=utf-8>
<title>Check how allowfullscreen affects fullscreen enabled flag</title>
<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#initialise-the-document-object">
<link rel="help" href="https://fullscreen.spec.whatwg.org/#fullscreen-enabled-flag">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div id="log"></div>
<script>
  async_test(function(t) {
    var iframe = document.createElement("iframe");
    iframe.src = "support/blank.htm";
    var eventWatcher = new EventWatcher(t, iframe, "load");
    document.body.appendChild(iframe);
    t.add_cleanup(function() {
      document.body.removeChild(iframe);
    });

    assert_true(document.fullscreenEnabled, "Top level document has fullscreen enabled flag set");
    eventWatcher.wait_for("load").then(t.step_func_done(function() {
      assert_false(iframe.contentDocument.fullscreenEnabled, "Document inside iframe without allowfullscreen attribute should not have fullscreen enabled flag set");
      iframe.setAttribute("allowfullscreen", true);
      assert_true(iframe.contentDocument.fullscreenEnabled, "Fullscreen should be allowed when allowfullscreen attribute is set");
      iframe.removeAttribute("allowfullscreen");
      assert_false(iframe.contentDocument.fullscreenEnabled, "Fullscreen should be denied when allowfullscreen attribute is removed");
    }));
  }, "iframe-allowfullscreen");

  /* Fullscreen enabled flag with about:blank */

  function test_allowfullscreen_noload(setup_iframe, check) {
    var iframe = document.createElement("iframe");
    setup_iframe(iframe);
    document.body.appendChild(iframe);
    check(iframe.contentDocument);
    document.body.removeChild(iframe);
  }

  test(function() {
    test_allowfullscreen_noload(function() {}, function(doc) {
      assert_false(doc.fullscreenEnabled, "Fullscreen should not be enabled without allowfullscreen attribute");
    });
  }, "iframe-noload-noallowfullscreen");

  test(function() {
    test_allowfullscreen_noload(function(iframe) {
      iframe.setAttribute("allowfullscreen", true);
    }, function(doc) {
      assert_true(doc.fullscreenEnabled, "Fullscreen should be enabled with allowfullscreen attribute");
    });
  }, "iframe-noload-allowfullscreen");
</script>