| <!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); |
| } |
| |
| var bc = new BroadcastChannel("portal-" + test); |
| bc.postMessage("loaded"); |
| bc.close(); |
| </script> |