<body onload="test()">
<p>Test how sandbox flags get inherited to initial document in subframe.</p>
<div id="result">Running...</div>
<iframe src="resources/iframe-no-src.html" sandbox="allow-same-origin"></iframe>
<script>
if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
}

var timeoutId;

function scriptWorked()
{
    document.getElementById("result").innerHTML = "FAIL";
    if (window.testRunner)
        testRunner.notifyDone();
    clearTimeout(timeoutId);
}

function timedOut()
{
    document.getElementById("result").innerHTML = "PASS";
    if (window.testRunner)
        testRunner.notifyDone();
}

function test()
{
    if (frames[0]) {
        var doc = frames[0].frames[0].document;
        var scr = doc.createElement("script");
        scr.appendChild(doc.createTextNode("top.scriptWorked()"));
        timeoutId = setTimeout(timedOut, 10);
        doc.body.appendChild(scr);
    } else {
        document.getElementById("result").innerHTML = "FAIL: no inner frame";
        testRunner.notifyDone();
    }
}
</script>
</body>
