blob: ff3e2789e8e2ec47801f8c07aab5f874ffe6d50b [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/js-test-pre.js"></script>
<div id="parent" style="width: 200px; height: 200px;">
<iframe id="iframe" seamless sandbox="allow-same-origin" src="resources/nested-seamless.html"></iframe>
</div>
<script>
debug("Test that sandbox disables nested seamless iframes correctly.")
window.onload = function () {
window.iframe = document.getElementById("iframe");
shouldBeTrue("iframe.seamless");
// The nested iframe is also "seamless", but the seamless-ness should be disabled by the sandbox.
window.nestedFrame = iframe.contentDocument.getElementById("iframe");
shouldBeTrue("nestedFrame.seamless");
// Even though it's prevented from actually being seamless, it should get the seamless styling from html.css.
shouldBeEqualToString("window.getComputedStyle(iframe).display", "block");
shouldBeEqualToString("window.getComputedStyle(iframe).borderWidth", "0px");
shouldBeEqualToString("window.getComputedStyle(iframe).borderStyle", "none");
// The sandboxed iframe is still seamless, but the iframe inside it is not and
// thus 300x150. Thus the sandboxed iframe should be the width of its parent,
// but the height of its iframe child (which is intrinsicly 150px).
shouldBeEqualToString("window.getComputedStyle(iframe).width", "200px");
shouldBeEqualToString("window.getComputedStyle(iframe).height", "150px");
}
</script>