summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/portals/resources/portal-repeated-activate-window.html
blob: e716034eff860fe567bc373f4676d55f97a5a786 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<body>
  <portal src="simple-portal-adopts-and-activates-predecessor.html">
  <script>
    function activate() {
      var portal = document.querySelector("portal");
      portal.activate().then(() => document.body.removeChild(portal));
    }

    var count = 0;
    window.onportalactivate = e => {
      ++count;
      if (count == 1) {
        e.adoptPredecessor().activate();
      } else {
        window.opener.postMessage("done", "*");
      }
    };
  </script>
</body>