File: browsing-context.html

package info (click to toggle)
firefox-esr 68.10.0esr-1~deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,143,932 kB
  • sloc: cpp: 5,227,879; javascript: 4,315,531; ansic: 2,467,042; python: 794,975; java: 349,993; asm: 232,034; xml: 228,320; sh: 82,008; lisp: 41,202; makefile: 22,347; perl: 15,555; objc: 5,277; cs: 4,725; yacc: 1,778; ada: 1,681; pascal: 1,673; lex: 1,417; exp: 527; php: 436; ruby: 225; awk: 162; sed: 53; csh: 44
file content (49 lines) | stat: -rw-r--r-- 2,731 bytes parent folder | download | duplicates (4)
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
<!doctype html>
<html>
  <head>
    <title>HTML Test: Browsing context is first created</title>
    <link rel="author" title="Intel" href="http://www.intel.com/" />
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
  </head>
  <body>
    <div id="log"></div>
    <script>
    var doc, iframe;

    setup(function () {
      // Create new browsing context via iframe
      iframe = document.createElement("iframe");
      document.body.appendChild(iframe);
      doc = iframe.contentDocument;
    });

    test(function () {
      assert_equals(doc.compatMode, "BackCompat", "The compatMode of a document without a document type declaration should be 'BackCompat'."); // Quirksmode
      assert_equals(doc.contentType, "text/html", "The document should be an HTML document.");
      assert_equals(doc.readyState, "complete", "The readyState attribute should be 'complete'.");
      // Document metadata...
      assert_equals(doc.documentURI, "about:blank", "The document's address should be 'about:blank'.");
      assert_equals(doc.URL, "about:blank", "The document's address should be 'about:blank'.");
      assert_equals(doc.doctype, null, "The docType of a document without a document type declaration should be null.");
      assert_equals(doc.characterSet, "UTF-8", "The document's encoding should be 'UTF-8'.");
    }, "Check that browsing context has new, ready HTML document");

    test(function () {
      assert_equals(doc.childNodes.length, 1, "The document must have only one child.");
      assert_equals(doc.documentElement.tagName, "HTML");
      assert_equals(doc.documentElement.childNodes.length, 2, "The HTML element should have 2 children.");
      assert_equals(doc.documentElement.childNodes[0].tagName, "HEAD", "The first child of HTML element should be a HEAD element.");
      assert_false(doc.documentElement.childNodes[0].hasChildNodes(), "The HEAD element should not have children.");
      assert_equals(doc.documentElement.childNodes[1].tagName, "BODY", "The second child of HTML element should be a BODY element.");
      assert_false(doc.documentElement.childNodes[1].hasChildNodes(), "The BODY element should not have children.");
    }, "Check that new document nodes extant, empty");

    test(function () {
      assert_equals(doc.origin, document.origin, "The document's origin should be its creator document's origin");
      assert_equals(doc.referrer, document.URL, "The document's referrer should be its creator document's address.");
      assert_equals(iframe.contentWindow.parent.document, document);
    }, "Check the document properties corresponding to the creator browsing context");
    </script>
  </body>
</html>