tor-browser

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

document.open-02.html (1093B)


      1 <!DOCTYPE html>
      2 <title>document.open with three arguments</title>
      3 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
      4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-open">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <div id="log"></div>
      8 <script>
      9 function open() {
     10  assert_unreached("The call should be redirected to the real window.open")
     11 }
     12 test(function(t) {
     13  var w;
     14  t.add_cleanup(function() {try {w.close()} catch(e) {}});
     15  w = document.open("/resources/testharness.js", "", "");
     16  assert_true(w instanceof w.Window, "Expected a window");
     17 }, "document.open should redirect to window.open when called with three arguments");
     18 
     19 test(function() {
     20  var parser = new DOMParser();
     21  var doc = parser.parseFromString("", "text/html");
     22  assert_equals(doc.defaultView, null);
     23  assert_throws_dom("INVALID_ACCESS_ERR", function() {
     24    doc.open("/resources/testharness.js", "", "");
     25  });
     26 }, "document.open should throw when it has no window and is called with three arguments");
     27 </script>