chromium/third_party/blink/web_tests/http/tests/security/sandboxed-iframe-origin-add.html

<html>
<head>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function log(msg) {
    var div = document.createElement("div");
    div.innerText = msg;
    document.getElementById("console").appendChild(div);
}

function fail() {
    log("FAIL: The origin of the document was mutated.");
    if (window.testRunner)
        testRunner.notifyDone();
}

function pass() {
    log("PASS");
    if (window.testRunner)
        testRunner.notifyDone();
}

window.addEventListener("message", function (evt) {
    var fr = document.getElementById("theFrame");
    if (evt.data == "step1-ready") {
        fr.sandbox = "allow-scripts allow-same-origin";
        fr.contentWindow.postMessage("go", "*");
    } else if (evt.data == "step1-done")
        fr.src = "resources/sandboxed-iframe-origin-add-step2.html";
}, false);

</script>
</head>

<body>
<p>Test that adding allow-origin after creating an iframe doesn't modify
the origin of an existing document, but it doesn modify the origin of the
next document.</p>

<div id="console"></div>
 
<iframe id="theFrame" sandbox="allow-scripts"
        src="resources/sandboxed-iframe-origin-add-step1.html">
</iframe>
</body>
</html>