layout/base/tests/bug482484.html
author Masayuki Nakano <masayuki@d-toybox.com>
Wed, 07 Dec 2011 14:13:06 +0900
changeset 83865 34b8fe0283576a3771e804b6d0c1d609eb1013c1
parent 75087 1188456710819d4606e74396be333ead9fe63261
child 83877 0c0b9724b1ada8550c34805926e57f41195250b4
permissions -rw-r--r--
Bug 700199 EventUtils.js should use synthesized events for sendKey(), sendChar() and sendString() rather than untrusted events r=ehsan+smaug+enndeakin+dolske

<!DOCTYPE HTML><html><head>
  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<div contentEditable="true" id="div"><p id="p">BC</p></div>
<script>
  // Position the caret before the "B"
  var div = document.getElementById('div');
  div.focus();
  var p = document.getElementById('p');
  var sel = window.getSelection();
  sel.removeAllRanges();
  var range = document.createRange();
  range.setStart(p.firstChild, 0)
  range.setEnd(p.firstChild, 0);
  sel.addRange(range);

  sendKey('UP');  // move UP
  sendChar('A');  // insert "A"
</script>
</body>
</html>