<!DOCTYPE html>
<html>
<head>
<meta name="referrer" content="origin">
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function receiveMessage(messageEvent) {
    if (messageEvent.data === "done") {
        if (window.testRunner)
            testRunner.notifyDone();
    } else if (messageEvent.data === "ready")
        target.postMessage("new-subframe", "*");
    else
        document.getElementById("log").innerHTML += messageEvent.data + "<br>";
}

window.addEventListener("message", receiveMessage, false);
</script>
</head>
<body>
<p>This test opens a new window that embeds a subframe. It passes, if the referrer is the origin only.</p>
<div id="log"></div>
<script>
var target = window.open("resources/nested-referrer-policy-postmessage.html");
</script>
</body>
</html>
