code: function addonsManager_waitForDownloaded(aSpec) {
      var spec = aSpec || { };
      var addon = spec.addon;
      var timeout = (spec.timeout == undefined) ? TIMEOUT_DOWNLOAD : spec.timeout;
  
      if (!addon)
        throw new Error(arguments.callee.name + ": Add-on not specified.");
  
      var self = this;
      var node = addon.getNode();
      
      // TODO: restore after 1.5.1 has landed
      // mozmill.utils.waitFor(function () {
      //   return node.getAttribute("pending") == "install" &&
      //          node.getAttribute("status") != "installing";
      // }, timeout, 100, "'" + node.getAttribute("name") + "' has been downloaded");
      
      mozmill.utils.waitForEval("subject.getAttribute('pending') == 'install' &&" +
                                "subject.getAttribute('status') != 'installing'",
                                timeout, 100, node);
    }
docs: Wait until the specified add-on has been downloaded
  
  @param {object} aSpec
  Object with parameters for customization
  Elements: addon   - Add-on element to wait for being downloaded
  timeout - Duration to wait for the target state
  [optional - default: 15s]