<html><head>
<title>Focus crash</title>
</head>
<body onload="load()">
To run this test manually, click the "Crash me" button.
<div id='container'>
    <iframe id='testframe' style="width: 100%; height:200px;" src="../resources/iframebody.html"></iframe>
</div>
<input id='testbutton' type="button" value="Crash me" onclick="crash()">
<ul id="console"></ul>
<script>

function load()
{
    document.getElementById('testframe').contentWindow.document.body.focus();
    if (window.testRunner)
        testRunner.dumpAsText();

    if (eventSender) {
        var button = document.getElementById('testbutton');
        eventSender.mouseMoveTo(button.offsetLeft + 10, button.offsetTop + 5)
        eventSender.mouseDown();
        eventSender.mouseUp();
    }
}

function crash()
{
    var focuselem = document.getElementById('testframe').contentWindow;
    var elem = document.getElementById('container');
    elem.style.display = 'none';
    focuselem.focus();
    log("SUCCEEDED");
}

function log(str) {
    var li = document.createElement("li");
    li.appendChild(document.createTextNode(str));
    var console = document.getElementById("console");
    console.appendChild(li);
}
</script>
</body>
</html>
