<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test window for top navigation with user activation</title>
<script>
window.onload = () => {
  opener.postMessage("READY", "*");
};

window.onhashchange = () => {
  opener.postMessage("NAVIGATED", "*");
};

window.onmessage = (e) => {
  if (e.data == "CLICK" || e.data == "SCRIPT") {
    frames[0].postMessage([e.data, location.href + "#hash"], "*");
  } else {
    opener.postMessage(e.data, "*");
  }
};
</script>
</head>
<body>
  <iframe sandbox="allow-scripts allow-top-navigation-by-user-activation" src="http://example.org/tests/docshell/test/iframesandbox/file_top_navigation_by_user_activation_iframe.html"></iframe>
</body>
</html>
