<!doctype html>
<title>opener and embedded documents; using a and form</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<iframe name=matchesastring></iframe>
<a href=/common/blank.html target=matchesastring>&lt;a></a>
<form action=/common/blank.html target=matchesastring><input type=submit value="<form>"></form>
<script>
async_test(t => {
  const frame = document.querySelector("iframe");
  let counter = 0;
  frame.onload = t.step_func(() => {
    // Firefox and Chrome/Safari load differently
    if (frame.contentWindow.location.href === "about:blank") {
      return;
    }

    // Test bits
    assert_equals(frame.contentWindow.opener, null);
    if (counter === 0) {
      document.querySelector("input").click();
    } else {
      t.done();
    }
    counter++;
  });
  document.querySelector("a").click();
});
</script>
