blob: 0da9491d3cd2c25e72257757422c813891e41fae [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script>
jsTestIsAsync = true;
var updatedFrameURL = "data:text/html,Updated contents of iframe";
var updatedObjectURL = "data:text/html,Updated contents of object";
function runTests()
{
shouldBe("window.frames.length", "2");
shouldBe("window.frames[0].frameElement.name", '"frame"');
shouldBe("window.frames[0].frameElement.contentWindow", "window.frames[0].frameElement.contentDocument.defaultView");
shouldBe("window.frames[0].frameElement.contentWindow.document", "window.frames[0].frameElement.contentDocument");
shouldBe("window.frames[1].frameElement.name", '"obj"');
shouldBe("window.frames[1].frameElement.contentWindow", "window.frames[1].frameElement.contentDocument.defaultView");
shouldBe("window.frames[1].frameElement.contentWindow.document", "window.frames[1].frameElement.contentDocument");
document.getElementsByName('frame')[0].onload = handleLoad;
document.getElementsByName('obj')[0].onload = handleLoad;
debug("Loading '" + updatedFrameURL + "' in iframe...");
debug("Loading '" + updatedObjectURL + "' in object...");
open(updatedFrameURL, "frame");
open(updatedObjectURL, "obj");
}
var numLoads = 0;
function handleLoad()
{
numLoads++;
if (numLoads < 2)
return;
shouldBe("window.frames[0].location.toString()", '"' + updatedFrameURL + '"');
shouldBe("window.frames[1].location.toString()", '"' + updatedObjectURL + '"');
finishJSTest();
}
</script>
</head>
<body onload="runTests()">
<iframe name="frame" src="data:text/html,Old contents of iframe"></iframe>
<object name="obj" type="text/html" data="data:text/html,Old contents of object"></object>
</body>
</html>