summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/windows/embedded-opener-a-form.html
blob: e1ec760b926670e610a96f02c935cf169563714a (plain)
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
<!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>