<html>
<head>
    <script src="cross-frame-access.js"></script>
    <script>
        function loaded()
        {
            if (window.testRunner) {
                function waitForFlag() {
                    if (!testRunner.globalFlag) {
                        setTimeout(waitForFlag, 1);
                        return;
                    }
                    performTest();
                }
                setTimeout(waitForFlag, 1);
            } else {
                log("Click the button when all the subframes have finished loading.");
            }
        }

        function performTest()
        {
            try {
                window.parent.frames[0].document.getElementById('accessMe').innerHTML = "PASS: Host name compare is case insensitive.";
            } catch (e) {
                log("FAIL: An error occurred during testing.")
            }

            if (window.testRunner)
                testRunner.notifyDone();
        }
    </script>
</head>
<body onload="loaded();">
    <p>Other inner iframe.</p>
    <button onclick="performTest();">Test</button>
    <pre id='console'></pre>
</body>
</html>
