<html>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
var t = async_test("This tests that an iframe with no src attribute uses the parent document's origin when resolving links inserted into the frame via JavaScript.");
function runTest() {
var frame = document.getElementById('theFrame');
assert_equals(frame.contentDocument.baseURI, document.baseURI);
var frameDoc = frame.contentWindow.document;
var innerFrame = frameDoc.createElement("iframe");
innerFrame.src = "resources/iframe-no-src-set-location-pass.html";
innerFrame.id = "innerFrame";
innerFrame.onload = t.step_func_done(function() {
assert_equals(frame.contentDocument.getElementById('innerFrame').contentDocument.body.innerHTML, 'PASS\n');
});
frameDoc.body.appendChild(innerFrame);
}
</script>
</head>
<body>
<iframe id="theFrame" onload="t.step(runTest)"></iframe>
</body>
</html>