<html><!-- webkit-test-runner [ JavaScriptCanOpenWindowsAutomatically=false ] -->
    <head>
        <script>
        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.dumpChildFramesAsText();
            testRunner.waitUntilDone();
        }

        function closeWindow(windowToClose)
        {
            windowToClose.close();
            setTimeout(doneHandler, 1);

            function doneHandler()
            {
                if (!windowToClose.closed)
                    setTimeout(doneHandler, 1);
                else if (window.testRunner)
                    testRunner.notifyDone();
            }
        }

        function handleClick(event) {
            var newWindow = window.open('resources/window-opened.html', 'badName', 'width=100, height=100');
            if (newWindow) {
                log("Window was opened! Test succeeded!");
                closeWindow(newWindow);
            }

            event.preventDefault();
            return false;
        }

        function test()
        {
            if (window.testRunner) {
                eventSender.mouseMoveTo(2, 2);
                eventSender.scheduleAsynchronousClick();
            }
        }

        function log(msg)
        {
            var res = document.getElementById('res');
            res.innerHTML = res.innerHTML + msg + "<br>";
        }
        </script>
    </head>
    <body style="border: 0; margin: 0" onload="test()">
        <iframe style="border: 0; margin: 0" src="resources/popup-blocking-click-in-iframe-otherFrame.html" id="otherFrame" name="otherFrame"></iframe>

        <p>This tests that popup blocking does not supress windows opened in an iframe if the event handler is a function from an enclosing frame.</p>
        <p>To run manually click the link in the iframe above with popup blocking enabled.</p>
        <div id="res"></div>
    </body>
</html>
