title: How to hook the download dialog in a Firefox extension?
body: <p>I'm writing a Firefox extension and I need to hook the download dialog that comes up when the user tries to download a file.</p>
  
  <p>In other words, I need a script-defined function to be notified <em>instead</em> of the dialog appearing as normal.</p>
  
  <p>Where do I begin? I tried reading through the XPCOM API Reference... but <a href="https://developer.mozilla.org/en/Observer_Notifications" rel="nofollow noreferrer">this</a> is the closest thing I could find.</p>