<!DOCTYPE html>
<html>
<body onload="runTest()">
<script> 
function focusAndSetDisplayNone() {
  var ta = document.getElementById("ta");
  ta.focus();
  ta.style.display = "none";
}

function getPositionOfNode(id)
{
    var n = document.getElementById(id);
    var pos = {x: 0, y: 0};

    while (n) {
        pos.x += n.offsetLeft + n.clientLeft;
        pos.y += n.offsetTop + n.clientTop;
        n = n.offsetParent;
    }
    return pos;
}

function runTest() {
  if (window.testRunner) {
    testRunner.dumpAsText()
    var pos = getPositionOfNode("clickTarget");
    // Repeat the test for better reproducability
    var i;
    for (i=0; i<10; ++i) {
      document.getElementById("ta").style.display="";
      eventSender.mouseMoveTo(pos.x + 5, pos.y + 5);
      eventSender.mouseDown();
      eventSender.mouseUp();
    }
  }
}
</script> 
<textarea id="ta">a</textarea> 
<span onclick="focusAndSetDisplayNone()" id="clickTarget">Click me</span><br>
To run manually, click the 'Click me' text.  Test passes if it does not crash.
</body>
</html>
