File: window_length.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 (51 lines) | stat: -rw-r--r-- 1,367 bytes parent folder | download | duplicates (35)
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
<!doctype html>
<title>window.length</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
var iframe;
var subframe;
var other_window;
test(function() {assert_equals(window.length, 0)}, "No child browsing contexts");
test(function() {
  iframe = document.createElement("iframe");
  assert_equals(window.length, 0)
}, "iframe not inserted into the document");

test(function() {
  document.body.appendChild(iframe);
  assert_equals(window.length, 1)
}, "One iframe inserted into the document");

test(function() {
  subframe = document.createElement("iframe");
  iframe.contentDocument.body.appendChild(subframe);
  assert_equals(window.length, 1);
}, "Child browsing context has a child browsing context");

test(function() {
  try {
    assert_equals(iframe.contentWindow.length, 1);
  } finally {
    subframe.parentNode.removeChild(subframe);
  }
}, "window.length in child frame");

test(function() {
  iframe.parentNode.removeChild(iframe);
  other_window = window.open();
  assert_equals(window.length, 0);
  assert_equals(other_window.length, 0);
}, "Opened window")

test(function() {
  other_window.document.body.appendChild(iframe);
  try {
    assert_equals(other_window.length, 1);
  } finally {
    other_window.close();
  }
}, "Iframe in opened window")

</script>