blob: b241bf32089a6dde1322cd8604caa9f28fb622bd [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script>
if (window.testRunner) {
window.testRunner.dumpAsText();
window.testRunner.waitUntilDone();
}
function childFrameWasNavigated()
{
// Check that the child frame was unable to load a plugin, since its parent is sandboxed.
shouldBeTrue("(self.sandboxedFrame.frameWithPlugin.document.getElementById('plugin').destroyStream) == undefined");
// Check a non-sandboxed frame as well, to ensure that the plugin is disabled by sandboxing
// and not some other failure
shouldBeTrue("(self.frameWithPlugin.document.getElementById('plugin').destroyStream) != undefined");
// When the child frame (grandchild of the main window) has been navigated,
// make the sandboxed frame navigate itself
self.sandboxedFrame.location.assign("javascript: top.sandboxWasNavigated();");
}
function sandboxWasNavigated()
{
shouldBeEqualToString("String(document.getElementById('sandboxedFrameId').sandbox)", "allow-scripts allow-same-origin");
isSuccessfullyParsed();
if (window.testRunner)
window.testRunner.notifyDone();
}
</script>
</head>
<body>
<iframe sandbox="allow-scripts allow-same-origin"
name="sandboxedFrame"
id="sandboxedFrameId"
src="resources/sandboxed-iframe-navigation-child.html">
</iframe>
<iframe name="frameWithPlugin"
src="resources/sandboxed-iframe-plugins-frame-object.html">
</iframe>
<script>
description("This test verifies that a sandboxed iframe CAN navigate both itself and a child in the frame tree. "
+ "It also verifies that the sandbox attribute remains intact after a frame has been navigated, "
+ "and that sandbox attributes are propagated through the frame hierarchy.");
</script>
</body>
</html>