File: indexed-browsing-contexts-01.html

package info (click to toggle)
thunderbird 1%3A143.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,703,968 kB
  • sloc: cpp: 7,770,492; javascript: 5,943,842; ansic: 3,918,754; python: 1,418,263; xml: 653,354; asm: 474,045; java: 183,079; sh: 111,238; makefile: 20,410; perl: 14,359; objc: 13,059; yacc: 4,583; pascal: 3,405; lex: 1,720; ruby: 999; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 69; csh: 10
file content (47 lines) | stat: -rw-r--r-- 2,211 bytes parent folder | download | duplicates (37)
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
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: the browsing contexts must be sorted in the order that their containers were inserted into the Document</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/browsers.html#accessing-other-browsing-contexts" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>

var t1 = async_test("The window's length must return the number of child browsing contexts(in iframe)");
function on_load1(fr) {
  t1.step(function () {
    var doc = fr.contentDocument;
    var fr3 = doc.createElement("iframe");
    fr3.setAttribute("id", "fr3");
    doc.body.insertBefore(fr3, doc.getElementById("tbl"));

    assert_equals(fr.contentWindow.length, 3, "The window.length should be 3.");
    assert_array_equals([fr.contentWindow[0].frameElement, fr.contentWindow[1].frameElement, fr.contentWindow[2].frameElement],
                        [fr.contentDocument.getElementById("fr4"), fr.contentDocument.getElementById("fr5"), fr.contentDocument.getElementById("fr3")],
                        "The child browsing contexts must be sorted in the order that their containers were inserted into the Document.");
  });
  t1.done();
}

var t2 = async_test("The window's length must return zero if it has no child browsing context");
function on_load2(fr) {
  t2.step(function () {
    assert_equals(fr.contentWindow.length, 0, "The window.length should be 0.");
  });
  t2.done();
}

</script>
<iframe id="fr1" src="test1.html" style="display:none" onload="on_load1(this)"></iframe>
<iframe id="fr2" src="test2.html" style="display:none" onload="on_load2(this)"></iframe>
<script>

test(function () {
  assert_equals(window.length, 2, "The window.length should be 2.");
  assert_array_equals([window[0].frameElement, window[1].frameElement],
                      [document.getElementById("fr1"), document.getElementById("fr2")],
                     "The child browsing contexts must be sorted in the tree order.");
}, "The window's length must return the number of child browsing contexts");

</script>