<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
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').loaded) == 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').loaded) != 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()
{
shouldBe("document.getElementById('sandboxedFrameId').sandbox", "['allow-scripts', 'allow-same-origin']");
document.getElementById('sandboxedFrameId').sandbox = "allow-scripts";
shouldBe("document.getElementById('sandboxedFrameId').getAttribute('sandbox')", "'allow-scripts'");
isSuccessfullyParsed();
if (window.testRunner)
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>