blob: 8db38d75be7e38279de7ff621c5cab2881a2d292 [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="main"/>
<script>
description("This tests that several ways of making an iframe that isn't inserted into a document tree"
+ " but has a child frame will fail.");
jsTestIsAsync = true;
main = document.getElementById("main");
try {
container = main.appendChild(document.createElement("div"));
helperFrame = container.appendChild(document.createElement("iframe"));
targetFrame1 = document.createElement("iframe");
helperFrame.contentWindow.onunload = function() {
container.insertBefore(targetFrame1, helperFrame);
}
main.removeChild(container);
} catch (e) { }
shouldBeTrue("targetFrame1.contentWindow == undefined");
try {
container = main.appendChild(document.createElement("div"));
helperElement = container.appendChild(document.createElement("input"));
helperElement.focus();
targetFrame2 = document.createElement("iframe");
helperElement.onblur = function() {
container.appendChild(targetFrame2);
}
main.removeChild(container);
} catch (e) { }
shouldBeTrue("targetFrame2.contentWindow == undefined");
try {
container = document.createElement("div");
targetFrame3 = container.appendChild(document.createElement("iframe"));
helperFrame = targetFrame3.appendChild(document.createElement("iframe"));
helperFrame.src = "javascript:top.container.removeChild(top.targetFrame3)";
document.body.appendChild(container);
} catch (e) { }
setTimeout(() => {
shouldBeTrue("targetFrame3.contentWindow == undefined");
finishJSTest();
}, 0);
</script>
</body>
</html>