code: function downloadManager_waitForDownloadState(download, state, timeout) {
      this._controller.waitForEval("subject.manager.getDownloadState(subject.download) == subject.state", timeout, 100,
                                   {manager: this, download: download, state: state});
    }
docs: Wait for the given download state
  
  @param {MozMillController} controller
  MozMillController of the window to operate on
  @param {downloadState} state
  Expected state of the download
  @param {number} timeout
  Timeout for waiting for the download state (optional)