<!doctype html>
<body>
</body>
<script>
  var searchParams = new URL(location).searchParams;
  var test = searchParams.get("test");
  var portal = document.createElement("portal");
  portal.src = `portals-adopt-predecessor-portal.html?test=${test}`;
  portal.onload = () => {
    portal.activate().then(() => {
      window.addEventListener("portalactivate", e => {
        window.opener.postMessage({test, message: "passed"}, "*");
      });
      window.portalHost.addEventListener("message", e => {
        window.opener.postMessage({test, message: e.data}, "*");
      });
    });
  }
  document.body.appendChild(portal);
</script>
