tor-browser

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

iframe-synchronously-discard.html (1500B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>IFrame discards are processed synchronously</title>
      4 <body></body>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script>
      8  async_test(function(t) {
      9    var child = document.createElement("iframe");
     10    child.src = "support/blank.htm?1";
     11    child.onload = t.step_func(function () {
     12      var childWindow = child.contentWindow;
     13      var grandchild = childWindow.document.createElement("iframe");
     14      grandchild.src = "blank.htm?2";
     15      grandchild.onload = t.step_func(function () {
     16        var grandchildWindow = grandchild.contentWindow;
     17        assert_equals(child.contentWindow, childWindow, "child window");
     18        assert_equals(childWindow.parent, window, "child parentage");
     19        assert_equals(grandchild.contentWindow, grandchildWindow, "grandchild window");
     20        assert_equals(grandchildWindow.parent, childWindow, "grandchild parentage");
     21        document.body.removeChild(child);
     22        assert_equals(child.contentWindow, null, "child should be discarded");
     23        assert_equals(childWindow.parent, null, "child window should be discarded");
     24        assert_equals(grandchild.contentWindow, null, "grandchild should be discarded");
     25        assert_equals(grandchildWindow.parent, null, "grandchild window should be discarded");
     26        t.done();
     27      });
     28      childWindow.document.body.appendChild(grandchild);
     29    });
     30    document.body.appendChild(child);
     31  });
     32 </script>