diff --git a/toolkit/mozapps/update/public/nsIUpdateService.idl b/toolkit/mozapps/update/public/nsIUpdateService.idl index f65fa3508cae..15087396e36b 100644 --- a/toolkit/mozapps/update/public/nsIUpdateService.idl +++ b/toolkit/mozapps/update/public/nsIUpdateService.idl @@ -239,7 +239,12 @@ interface nsIUpdateManager : nsISupports /** * */ - readonly attribute nsISimpleEnumerator updates; + nsIUpdate getUpdateAt(in long index); + + /** + * + */ + readonly attribute long updateCount; /** * diff --git a/toolkit/mozapps/update/src/nsUpdateService.js.in b/toolkit/mozapps/update/src/nsUpdateService.js.in index e9024eff2ee7..e2c07baf6ac4 100644 --- a/toolkit/mozapps/update/src/nsUpdateService.js.in +++ b/toolkit/mozapps/update/src/nsUpdateService.js.in @@ -631,6 +631,11 @@ UpdateManager.prototype = { */ _data: null, + /** + * + */ + _updates: [], + /** * */ @@ -644,13 +649,25 @@ UpdateManager.prototype = { var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"] .createInstance(Components.interfaces.nsIDOMParser); this._data = parser.parseFromString(data, "text/xml"); + + var updateCount = this._data.documentElement.childNodes.length; + for (var i = 0; i < updateCount; ++i) { + var updateNode = this._data.documentElement.childNodes[i]; + this._updates.push(parseUpdateNode(updateNode)); + } } }, /** * See nsIUpdateService.idl */ - get updates() { + getUpdateAt: function(index) { + }, + + /** + * See nsIUpdateService.idl + */ + get updateCount() { }, /** @@ -755,13 +772,14 @@ UpdatePatch.prototype = { * Update * Implements nsIUpdate */ -function Update(type, version, extensionversion, detailsurl, licenseurl, patches) { +function Update(type, version, extensionversion, detailsurl, licenseurl, installDate, patches) { this.type = type; this.version = version; this.extensionversion = extensionversion; this.detailsurl = detailsurl; this.licenseurl = licenseurl; this.isCompleteUpdate = false; + this.installDate = installDate; this._patches = patches; } @@ -793,10 +811,10 @@ Update.prototype = { /** - * ParseUpdateNode + * parseUpdateNode * Parses an element into an Update object. */ -function ParseUpdateNode(node) { +function parseUpdateNode(node) { patches = []; for (var i = 0; i < node.childNodes.length; ++i) { @@ -817,6 +835,7 @@ function ParseUpdateNode(node) { node.getAttribute("extensionversion"), node.getAttribute("detailsurl"), node.getAttribute("licenseurl"), + node.hasAttribute("installdate") ? node.getAttribute("installdate") : 0, patches); } @@ -881,7 +900,7 @@ Checker.prototype = { if (updateElement.nodeType != Node.ELEMENT_NODE) continue; - updates.push(ParseUpdateNode(updateElement)); + updates.push(parseUpdateNode(updateElement)); } return updates;