blob: ad3bfd7b3bad963fe3e47b62e8bce4a16efe09fa [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
function ownerWindow()
{
var owner = window.parent;
if (owner === this)
owner = window.opener;
return owner;
}
function receiveMessage(messageEvent)
{
if (messageEvent.source !== ownerWindow())
ownerWindow().postMessage(messageEvent.data, "*"); // Forward to owner
else {
// From owner
if (messageEvent.data === "new-window")
window.open("referrer-policy-postmessage.py");
else if (messageEvent.data === "new-subframe") {
var subframe = document.createElement("iframe");
subframe.src = "referrer-policy-postmessage.py";
document.body.appendChild(subframe);
}
}
}
window.addEventListener("message", receiveMessage, false);
ownerWindow().postMessage("ready", "*");
</script>
</head>
</html>