title: Simulating mouse events in Firefox extension
body: <p>I need to simulate trusted mousemove event in JavaScript. As I read there:</p>
  
  <p><a href="http://help.dottoro.com/ljoljvsn.php" rel="nofollow noreferrer">http://help.dottoro.com/ljoljvsn.php</a></p>
  
  <blockquote>
    <p>In Firefox, an event is trusted if it is invoked by the user and not trusted if it is invoked by script. </p>
  </blockquote>
  
  <p>And after that I started search other solution. I found this: </p>
  
  <p><a href="https://stackoverflow.com/questions/11456705/are-events-generated-by-firefox-extension-trusted">Are events generated by Firefox extension &#39;trusted&#39;?</a></p>
  
  <blockquote>
    <p>Yes, events generated by extensions are always trusted. </p>
  </blockquote>
  
  <p>So, now I want write FireFox extension to allow me create mousemove trusted event. Unfortunately, I've never written extensions FireFox, so I need to clarify some points. What I have:</p>
  
  <ol>
  <li>I downloaded example of XPI file</li>
  <li>I created install.rdf and bootstrap.js for bootstraped extension (like FireBug)</li>
  </ol>
  
  <p>But now I don't understand:</p>
  
  <ol>
  <li>In this article:
  <a href="https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Miscellaneous#Simulating_mouse_and_key_events" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Miscellaneous#Simulating_mouse_and_key_events</a></li>
  </ol>
  
  <p>i see code:</p>
  
  <pre><code>var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                        .getInterface(Components.interfaces.nsIDOMWindowUtils);
  utils.sendMouseEvent("mousedown", 10, 10, 0, 1, 0); utils.sendMouseEvent("mouseup", 10, 10, 0, 1, 0);
  </code></pre>
  
  <p>what point in bootstrap.js I must insert this code? How I understand I must attach it in some active(or specified?) window.</p>
  
  <ol start="2">
  <li>How can I can run extension code in my JavaScript like global object "console" in FireBug extension?</li>
  </ol>
  
  <p>I would appreciate an explanation</p>