<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Navigate a child window.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/soft-navigation-helper.js"></script>
</head>
<body>
  <main id=main>
  <a href="empty.html?2" rel=opener target=child id=link>Click me!</a>
  </main>
  <script>
    promise_test(async t => {
      const child = window.open("resources/empty.html?1", "child");
      while (!child.document) {
        await new Promise(r => t.step_timeout(r, 10));
      }
      const link = document.getElementById("link");
      click(link);
      while (!child.location.href.includes("2")) {
        await new Promise(r => t.step_timeout(r, 10));
      }
    }, "Test that a navigated child window doesn't crash");
  </script>
</body>
</html>
