title: How do I programmatically download a file created on the file with a Firefox WebExtension?
body: <p>I am trying to port a Chrome Extension that programmatically creates and downloads a file to a Firefox WebExtension, using Firefox 45.0.1.</p>
  
  <p>This is the Javascript code:</p>
  
  <pre class="lang-javascript prettyprint-override"><code>  text = '{"greeting":"Hello, World!"}';
    var a = document.createElement('a');
    var file = new Blob([text], {type: 'text/json'});
    a.href = URL.createObjectURL(file);
    a.download = 'hello.world';   // Filename  
    a.click();                    // Trigger download 
  </code></pre>
  
  <p>All lines seem to execute fine, but no file is downloaded (I put a <code>console.log()</code> after the <code>a.click()</code>).</p>
  
  <p>As of now there is no chrome.downloads API in Firefox WebExtensions.</p>
  
  <p>Is there any incompatibility with Firefox in the code above? Is there any other alternative to programmatically download a file using a Firefox WebExtension?</p>