B2G/gecko/testing/peptest/peptest/extension/resource/mozmill/stdlib/EventUtils.js
/**
 * Actually perform event dispatch given a charCode, keyCode, and boolean for
 * whether "shift" was pressed.  Send the event to the node with id aTarget.  If
 * aTarget is not provided, use "target".
 *
 * Returns true if the keypress event was accepted (no calls to preventDefault
 * or anything like that), false otherwise.
 */
Actually perform event dispatch given a charCode, keyCode, and boolean for
whether "shift" was pressed.  Send the event to the node with id aTarget.  If
aTarget is not provided, use "target".

Returns true if the keypress event was accepted (no calls to preventDefault
or anything like that), false otherwise.
Actually perform event dispatch given a charCode keyCode and boolean for whether " shift " was pressed . Send the event to the node with id aTarget . If aTarget is not provided use " target " . Returns true if the keypress event was accepted ( no calls to preventDefault or anything like that ) false otherwise .
function __doEventDispatch(aTarget, aCharCode, aKeyCode, aHasShift) {
  if (aTarget === undefined) {
    aTarget = "target";
  }
  var event = document.createEvent("KeyEvents");
  event.initKeyEvent("keydown", true, true, document.defaultView,
                     false, false, aHasShift, false,
                     aKeyCode, 0);
  var accepted = $(aTarget).dispatchEvent(event);
  event = document.createEvent("KeyEvents");
  if (aCharCode) {
    event.initKeyEvent("keypress", true, true, document.defaultView,
                       false, false, aHasShift, false,
                       0, aCharCode);
  } else {
    event.initKeyEvent("keypress", true, true, document.defaultView,
                       false, false, aHasShift, false,
                       aKeyCode, 0);
  }
  if (!accepted) {
    event.preventDefault();
  }
  accepted = $(aTarget).dispatchEvent(event);
  var event = document.createEvent("KeyEvents");
  event.initKeyEvent("keyup", true, true, document.defaultView,
                     false, false, aHasShift, false,
                     aKeyCode, 0);
  $(aTarget).dispatchEvent(event);
  return accepted;
}
function __doEventDispatch ( aTarget , aCharCode , aKeyCode , aHasShift ) { if ( aTarget === undefined ) { aTarget = "target" ; } var event = document . createEvent ( "KeyEvents" ) ; event . initKeyEvent ( "keydown" , true , true , document . defaultView , false , false , aHasShift , false , aKeyCode , 0 ) ; var accepted = $ ( aTarget ) . dispatchEvent ( event ) ; event = document . createEvent ( "KeyEvents" ) ; if ( aCharCode ) { event . initKeyEvent ( "keypress" , true , true , document . defaultView , false , false , aHasShift , false , 0 , aCharCode ) ; } else { event . initKeyEvent ( "keypress" , true , true , document . defaultView , false , false , aHasShift , false , aKeyCode , 0 ) ; } if ( ! accepted ) { event . preventDefault ( ) ; } accepted = $ ( aTarget ) . dispatchEvent ( event ) ; var event = document . createEvent ( "KeyEvents" ) ; event . initKeyEvent ( "keyup" , true , true , document . defaultView , false , false , aHasShift , false , aKeyCode , 0 ) ; $ ( aTarget ) . dispatchEvent ( event ) ; return accepted ; }
Actually perform event dispatch given a charCode, keyCode, and boolean for
 whether "shift" was pressed.
Actually perform event dispatch given a charCode keyCode and boolean for whether " shift " was pressed .
// Preventing the default keydown action also prevents the default // keypress action. // Always send keyup