blob: 36fc2b48c8d87e10a1cb533e19372de1a9251825 [file] [edit]
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
function openPortalAndReceiveMessage(portalSrc) {
let portal = document.createElement('portal');
portal.src = portalSrc;
let received = new Promise((resolve, reject) => {
portal.onmessage = resolve;
document.body.appendChild(portal);
});
return received;
}
promise_test(() => {
return openPortalAndReceiveMessage("resources/portal-host.html");
}, "window.portalHost should be exposed in same-origin portal");
promise_test(() => {
return openPortalAndReceiveMessage(
"http://{{hosts[alt][www]}}:{{ports[http][0]}}/portals/resources/portal-host.html");
}, "window.portalHost should be exposed in cross-origin portal");
promise_test(() => {
return openPortalAndReceiveMessage(
'resources/portal-host-cross-origin-navigate.sub.html');
}, "window.portalHost should be exposed in portal after cross-origin navigation");
</script>
</body>