<!DOCTYPE html>
<html>
    <head>
        <script>
        function testcase()
        {
            if (window.testRunner) {
                testRunner.dumpAsText();
                testRunner.waitUntilDone();
            }
            document.designMode = 'on';
            setTimeout(run, 0);
        }
        function run()
        {
            var iframe = document.getElementById("iframe");
            window.addEventListener('focusin', eventHandle);
            var element = iframe.contentWindow.document.getElementById("input");
            element.value = 'demo';
            element.selectionStart = 0;
        }
        function eventHandle(event)
        {
            body.innerText = "Test passes if WebKit doesn't crash.";
            setTimeout(finish, 0);
        }
        function finish()
        {
            if (window.testRunner)
                testRunner.notifyDone();
        }
        </script>
    </head>
    <body onload='testcase();' id='body' >
        <iframe id='iframe' src='resources/select-iframe-focusin-document-crash-frame.html'></iframe>
    </body>
</html>
