tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

window_length.html (1367B)


      1 <!doctype html>
      2 <title>window.length</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <div id=log></div>
      6 <script>
      7 var iframe;
      8 var subframe;
      9 var other_window;
     10 test(function() {assert_equals(window.length, 0)}, "No child browsing contexts");
     11 test(function() {
     12  iframe = document.createElement("iframe");
     13  assert_equals(window.length, 0)
     14 }, "iframe not inserted into the document");
     15 
     16 test(function() {
     17  document.body.appendChild(iframe);
     18  assert_equals(window.length, 1)
     19 }, "One iframe inserted into the document");
     20 
     21 test(function() {
     22  subframe = document.createElement("iframe");
     23  iframe.contentDocument.body.appendChild(subframe);
     24  assert_equals(window.length, 1);
     25 }, "Child browsing context has a child browsing context");
     26 
     27 test(function() {
     28  try {
     29    assert_equals(iframe.contentWindow.length, 1);
     30  } finally {
     31    subframe.parentNode.removeChild(subframe);
     32  }
     33 }, "window.length in child frame");
     34 
     35 test(function() {
     36  iframe.parentNode.removeChild(iframe);
     37  other_window = window.open();
     38  assert_equals(window.length, 0);
     39  assert_equals(other_window.length, 0);
     40 }, "Opened window")
     41 
     42 test(function() {
     43  other_window.document.body.appendChild(iframe);
     44  try {
     45    assert_equals(other_window.length, 1);
     46  } finally {
     47    other_window.close();
     48  }
     49 }, "Iframe in opened window")
     50 
     51 </script>