summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/portals/resources/portal-post-message-during-activate-window.html
blob: 6e220277d9fe60dd26caa6a199c9eaf46adc6fb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<body>
  <script>
    var portal = document.createElement("portal");
    portal.src = "simple-portal.html";
    document.body.appendChild(portal);

    portal.onload = () => {
      portal.activate();
      error = "";
      try {
        portal.postMessage("message");
      } catch (err) {
        error = err.name;
      }
      bc = new BroadcastChannel("portals-post-message-during-activate");
      bc.postMessage(error);
      bc.close();
    }
  </script>
</body>