<!DOCTYPE html>
<html>
<body>
<div id="parentDiv">
<div id="firstChildDiv" contenteditable>first child div</div>
<div id="secondChildDiv" contenteditable>second child div</div>
<div/>
<script>

function clickOnTestPage(x, y, keys) {
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown(0, keys);
    eventSender.mouseUp(0, keys);
}

function runTest() {
    var parentDivElement = document.getElementById('parentDiv');
    clickOnTestPage(parentDivElement.offsetLeft + 10, parentDivElement.offsetTop + 10);
    eventSender.leapForward(300);
    window.onmousedown = removeFirstChildDiv;
    clickOnTestPage(100, 100, ['shiftKey']);
    document.getElementById('secondChildDiv').innerHTML = "This test shift clicks outside of a focused div with removing the focused div from the dom tree at the same time. If this doesn't crash, then the test passes.";
}

function removeFirstChildDiv() {
    var parentDivElement = document.getElementById('parentDiv');
    var childDivElement = document.getElementById('firstChildDiv');
    parentDivElement.removeChild(childDivElement);
}

if (window.eventSender)
    runTest();

if (window.testRunner)
    testRunner.dumpAsText();

</script>
</body>
</html>
