function doKey(aKey, modifier) {
    var keyName = "DOM_VK_" + aKey.toUpperCase();
    var key = KeyEvent[keyName];

    // undefined --> null
    if (!modifier)
        modifier = null;

    // Window utils for sending fake sey events.
    var wutils = SpecialPowers.wrap(window).
                          QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
                          getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);

    if (wutils.sendKeyEvent("keydown",  key, 0, modifier)) {
      wutils.sendKeyEvent("keypress", key, 0, modifier);
    }
    wutils.sendKeyEvent("keyup",    key, 0, modifier);
}
// This basically sends an untargeted key event, to whatever's focused.
This basically sends an untargeted key event, to whatever's focused.
This basically sends an untargeted key event to whatever ' s focused .
function doKey(aKey, modifier) {
    var keyName = "DOM_VK_" + aKey.toUpperCase();
    var key = KeyEvent[keyName];
    if (!modifier)
        modifier = null;
    var wutils = SpecialPowers.wrap(window).
                          QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
                          getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
    if (wutils.sendKeyEvent("keydown",  key, 0, modifier)) {
      wutils.sendKeyEvent("keypress", key, 0, modifier);
    }
    wutils.sendKeyEvent("keyup",    key, 0, modifier);
}
function doKey ( aKey , modifier ) { var keyName = "DOM_VK_" + aKey . toUpperCase ( ) ; var key = KeyEvent [ keyName ] ; if ( ! modifier ) modifier = null ; var wutils = SpecialPowers . wrap ( window ) . QueryInterface ( SpecialPowers . Ci . nsIInterfaceRequestor ) . getInterface ( SpecialPowers . Ci . nsIDOMWindowUtils ) ; if ( wutils . sendKeyEvent ( "keydown" , key , 0 , modifier ) ) { wutils . sendKeyEvent ( "keypress" , key , 0 , modifier ) ; } wutils . sendKeyEvent ( "keyup" , key , 0 , modifier ) ; }
This basically sends an untargeted key event, to whatever's focused.
This basically sends an untargeted key event to whatever ' s focused .
// undefined --> null // Window utils for sending fake sey events.