<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script>
var iframeHasLoadedFirstPage = false;

function runTest()
{
    shouldBeEqualToString("document.getElementById('theFrame').contentDocument.baseURI", "http://127.0.0.1:8000/dom/iframe-no-src-local-origin-allow.html");
    var frameDoc = document.getElementById('theFrame').contentWindow.document;
    var innerFrame = frameDoc.createElement("iframe");
    innerFrame.src = "resources/iframe-no-src-set-location-pass.html";
    innerFrame.id = "innerFrame";
    innerFrame.onload = function() {
        shouldBe("document.getElementById('theFrame').contentDocument.getElementById('innerFrame').contentDocument.body.innerHTML", "'PASS\\n'");
        finishJSTest();
    }
    frameDoc.body.appendChild(innerFrame);
}

</script>
</head>
<body>
<script>
description("This tests that an iframe with no src attribute uses the parent document's origin when resolving links inserted into the frame via JavaScript.");
jsTestIsAsync = true;
</script>
<iframe id="theFrame" onload="runTest()"></iframe>
</body>
</html>
