<html>
<head>
    <script>
        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.waitUntilDone();
        }

        function onloadForButtonChild() { 
            var targetChild = document.getElementById('targetChild');
            targetChild.src = "resources/xss-inactive-closure-child.html";
            targetChild.onload = start;
        }

        function start() {
            var buttonChild = window.frames[1];
            buttonChild.document.getElementById('button').click();

            if (window.testRunner)
                testRunner.notifyDone();
        }
        function log(msg) {
            document.getElementById('result').innerHTML = msg;
        }
    </script>
</head>
<body>
    <p>This tests that when a frame navigates to a new page, closures in the old page cannot access page content of the new page if there are from different domains.</p>
    <p>You should see PASSED at the end of page if the test passes.</p>
    <div id="result">PASSED</div>
    <iframe id="targetChild" src=""></iframe>
    <iframe src="resources/childWithButton.html" onload="onloadForButtonChild();"></iframe>
</body>
</html>
