summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/portals/resources/portal-activate-event-portal.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/portals/resources/portal-activate-event-portal.html')
-rw-r--r--testing/web-platform/tests/portals/resources/portal-activate-event-portal.html21
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/web-platform/tests/portals/resources/portal-activate-event-portal.html b/testing/web-platform/tests/portals/resources/portal-activate-event-portal.html
new file mode 100644
index 0000000000..6de5aafca7
--- /dev/null
+++ b/testing/web-platform/tests/portals/resources/portal-activate-event-portal.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<title>Tests that the PortalActivateEvent is dispatched when a portal is activated</title>
+<script>
+ var test = (new URL(location)).searchParams.get("test");
+
+ function portalActivate(e) {
+ var bc = new BroadcastChannel("test-" + test);
+ bc.postMessage("passed");
+ bc.close();
+ }
+
+ if (test == "bodyeventhandler") {
+ document.write('<body onportalactivate="portalActivate()"></body>');
+ } else if (test == "eventhandler") {
+ window.onportalactivate = portalActivate;
+ } else if (test == "eventlistener") {
+ window.addEventListener("portalactivate", portalActivate);
+ }
+
+ window.portalHost.postMessage("loaded");
+</script>