B2G/gecko/testing/marionette/marionette-server.js
/**
   * Send click event to element
   *
   * @param object aRequest
   *        'element' member holds the reference id to
   *        the element that will be clicked
   */
Send click event to element
@param object aRequest
'element' member holds the reference id to
the element that will be clicked
Send click event to element @param object aRequest ' element ' member holds the reference id to the element that will be clicked
function MDA_clickElement(aRequest) {
    let command_id = this.command_id = this.getCommandId();
    if (this.context == "chrome") {
      try {
        let el = this.curBrowser.elementManager.getKnownElement(
            aRequest.element, this.getCurrentWindow());
        el.click();
        this.sendOk(command_id);
      }
      catch (e) {
        this.sendError(e.message, e.code, e.stack, command_id);
      }
    }
    else {
      let curWindow = this.getCurrentWindow();
      let self = this;
      this.mozBrowserClose = function() { 
        curWindow.removeEventListener('mozbrowserclose', self.mozBrowserClose, true);
        self.switchToGlobalMessageManager();
        self.sendError("The frame closed during the click, recovering to allow further communications", 500, null, command_id);
      };
      curWindow.addEventListener('mozbrowserclose', this.mozBrowserClose, true);
      this.sendAsync("clickElement",
                     { element: aRequest.element },
                     command_id);
    }
  }
function MDA_clickElement ( aRequest ) { let command_id = this . command_id = this . getCommandId ( ) ; if ( this . context == "chrome" ) { try { let el = this . curBrowser . elementManager . getKnownElement ( aRequest . element , this . getCurrentWindow ( ) ) ; el . click ( ) ; this . sendOk ( command_id ) ; } catch ( e ) { this . sendError ( e . message , e . code , e . stack , command_id ) ; } } else { let curWindow = this . getCurrentWindow ( ) ; let self = this ; this . mozBrowserClose = function ( ) { curWindow . removeEventListener ( 'mozbrowserclose' , self . mozBrowserClose , true ) ; self . switchToGlobalMessageManager ( ) ; self . sendError ( "The frame closed during the click, recovering to allow further communications" , 500 , null , command_id ) ; } ; curWindow . addEventListener ( 'mozbrowserclose' , this . mozBrowserClose , true ) ; this . sendAsync ( "clickElement" , { element : aRequest . element } , command_id ) ; } }
Send click event to element
 @param object aRequest
        'element' member holds the reference id to
        the element that will be clicked
Send click event to element @param object aRequest ' element ' member holds the reference id to the element that will be clicked
//NOTE: click atom fails, fall back to click() action // We need to protect against the click causing an OOP frame to close.  // This fires the mozbrowserclose event when it closes so we need to  // listen for it and then just send an error back. The person making the // call should be aware something isnt right and handle accordingly