B2G/gecko/testing/marionette/marionette-listener.js
/**
 * Function to emit touch events which allow multi touch on the screen
 * @param type represents the type of event, touch represents the current touch,touches are all pending touches
 */
Function to emit touch events which allow multi touch on the screen
@param type represents the type of event, touch represents the current touch,touches are all pending touches
Function to emit touch events which allow multi touch on the screen @param type represents the type of event touch represents the current touch touches are all pending touches
function emitMultiEvents(type, touch, touches) {
  let target = touch.target;
  let doc = target.ownerDocument;
  let win = doc.defaultView;
  let documentTouches = doc.createTouchList(touches.filter(function(t) {
    return ((t.target.ownerDocument === doc) && (type != 'touchcancel'));
  }));
  let targetTouches = doc.createTouchList(touches.filter(function(t) {
    return ((t.target === target) && ((type != 'touchcancel') || (type != 'touchend')));
  }));
  let changedTouches = doc.createTouchList(touch);
  let event = curWindow.document.createEvent('TouchEvent');
  event.initTouchEvent(type,
                       true,
                       true,
                       win,
                       0,
                       false, false, false, false,
                       documentTouches,
                       targetTouches,
                       changedTouches);
  target.dispatchEvent(event);
}
function emitMultiEvents ( type , touch , touches ) { let target = touch . target ; let doc = target . ownerDocument ; let win = doc . defaultView ; let documentTouches = doc . createTouchList ( touches . filter ( function ( t ) { return ( ( t . target . ownerDocument === doc ) && ( type != 'touchcancel' ) ) ; } ) ) ; let targetTouches = doc . createTouchList ( touches . filter ( function ( t ) { return ( ( t . target === target ) && ( ( type != 'touchcancel' ) || ( type != 'touchend' ) ) ) ; } ) ) ; let changedTouches = doc . createTouchList ( touch ) ; let event = curWindow . document . createEvent ( 'TouchEvent' ) ; event . initTouchEvent ( type , true , true , win , 0 , false , false , false , false , documentTouches , targetTouches , changedTouches ) ; target . dispatchEvent ( event ) ; }
Function to emit touch events which allow multi touch on the screen
 @param type represents the type of event, touch represents the current touch,touches are all pending touches
Function to emit touch events which allow multi touch on the screen @param type represents the type of event touch represents the current touch touches are all pending touches
// touches that are in the same document // touches on the same target // Create changed touches // Create the event object