title: How to paste a text to the browser?
body: <p>Following <a href="https://developer.mozilla.org/en/Using_the_Clipboard#section_2" rel="nofollow">this tutorial</a> I was able to retrieve data form the clipboard.</p>
  
  <p>But I have no idea (nither there's something in the API) about how to insert my string into <a href="https://developer.mozilla.org/en/XUL/browser" rel="nofollow">the xul browser</a> (say, when the user open the 'edit' menu and click 'paste').</p>
  
  <p>Any idea?</p>
  
  <p><strong>--update</strong></p>
  
  <p>There's a <code>cmd_paste</code> <a href="https://developer.mozilla.org/en/XUL/List_of_commands" rel="nofollow">here</a>, but there's no hint if I can (and how to) use it to paste in a browser. Also the <a href="https://developer.mozilla.org/en/XUL/browser" rel="nofollow">browser's API</a> available documentation have nothing about.</p>
  
  <p>I tried make it work creating a browser, setting the <code>command</code> attribute (not sure if it exists, <a href="https://developer.mozilla.org/en/XUL/browser" rel="nofollow">the API</a> says nothing, but it's a wiki not much reliable) and a button to paste:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;?xml-stylesheet href="chrome://global/skin/" type="text/css"?&gt;
  
  &lt;window width="400" height="300"
      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"&gt;
  
      &lt;browser id="mybrowser" command="cmd_paste" type="content" src="http://www.google.com/" flex="1" /&gt;
      &lt;button label="TEST PASTE" command="document.getElementById('mybrowser').doCommand();" /&gt;
  
  &lt;/window&gt;
  </code></pre>
  
  <p>Nothing happens when I press the button (with data on my clipboard, and a text field selected inside the browser).</p>
  
  <p><strong>--in the xulrunner source</strong></p>
  
  <p>within toolkit.jar, at content/global/editMenuOverlay.xul there's the definition:</p>
  
  <pre><code>&lt;command id="cmd_paste" oncommand="goDoCommand('cmd_paste')"/&gt;
  </code></pre>
  
  <p>but no "goDoCommand" method is defined there, nither in the only javascript file included: <code>editMenuOverlay.js</code>.</p>