<p>This tests a crash when changing focus deletes the node being focused. This test requires DRT.</p>
<div id='test'><input id='1' /><input id='2' /></div>
<script>
function runTest()
{
    document.getElementById("1").addEventListener("keypress", function(e) {
        document.getElementById("2").focus();

        setTimeout(function() {
            document.getElementById("test").innerHTML = "PASSED";
            testRunner.notifyDone();
        }, 0);
    }, false);

    document.getElementById("1").addEventListener("change", function(e) {
        document.getElementById("test").innerHTML = "<input id='3' />";
        window.GCController.collect();
        document.getElementById("3").focus();
    }, false);

    document.getElementById("1").focus();

    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
        eventSender.keyDown("a")
    }
}

runTest();
</script>
