зеркало из https://github.com/mozilla/gecko-dev.git
more update manager work
This commit is contained in:
Родитель
32ddfe36a3
Коммит
2633a4810b
|
@ -239,7 +239,12 @@ interface nsIUpdateManager : nsISupports
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
readonly attribute nsISimpleEnumerator updates;
|
nsIUpdate getUpdateAt(in long index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
readonly attribute long updateCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -631,6 +631,11 @@ UpdateManager.prototype = {
|
||||||
*/
|
*/
|
||||||
_data: null,
|
_data: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
_updates: [],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -644,13 +649,25 @@ UpdateManager.prototype = {
|
||||||
var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
|
var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
|
||||||
.createInstance(Components.interfaces.nsIDOMParser);
|
.createInstance(Components.interfaces.nsIDOMParser);
|
||||||
this._data = parser.parseFromString(data, "text/xml");
|
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
|
* See nsIUpdateService.idl
|
||||||
*/
|
*/
|
||||||
get updates() {
|
getUpdateAt: function(index) {
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See nsIUpdateService.idl
|
||||||
|
*/
|
||||||
|
get updateCount() {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -755,13 +772,14 @@ UpdatePatch.prototype = {
|
||||||
* Update
|
* Update
|
||||||
* Implements nsIUpdate
|
* Implements nsIUpdate
|
||||||
*/
|
*/
|
||||||
function Update(type, version, extensionversion, detailsurl, licenseurl, patches) {
|
function Update(type, version, extensionversion, detailsurl, licenseurl, installDate, patches) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.extensionversion = extensionversion;
|
this.extensionversion = extensionversion;
|
||||||
this.detailsurl = detailsurl;
|
this.detailsurl = detailsurl;
|
||||||
this.licenseurl = licenseurl;
|
this.licenseurl = licenseurl;
|
||||||
this.isCompleteUpdate = false;
|
this.isCompleteUpdate = false;
|
||||||
|
this.installDate = installDate;
|
||||||
this._patches = patches;
|
this._patches = patches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,10 +811,10 @@ Update.prototype = {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ParseUpdateNode
|
* parseUpdateNode
|
||||||
* Parses an <update> element into an Update object.
|
* Parses an <update> element into an Update object.
|
||||||
*/
|
*/
|
||||||
function ParseUpdateNode(node) {
|
function parseUpdateNode(node) {
|
||||||
patches = [];
|
patches = [];
|
||||||
|
|
||||||
for (var i = 0; i < node.childNodes.length; ++i) {
|
for (var i = 0; i < node.childNodes.length; ++i) {
|
||||||
|
@ -817,6 +835,7 @@ function ParseUpdateNode(node) {
|
||||||
node.getAttribute("extensionversion"),
|
node.getAttribute("extensionversion"),
|
||||||
node.getAttribute("detailsurl"),
|
node.getAttribute("detailsurl"),
|
||||||
node.getAttribute("licenseurl"),
|
node.getAttribute("licenseurl"),
|
||||||
|
node.hasAttribute("installdate") ? node.getAttribute("installdate") : 0,
|
||||||
patches);
|
patches);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,7 +900,7 @@ Checker.prototype = {
|
||||||
if (updateElement.nodeType != Node.ELEMENT_NODE)
|
if (updateElement.nodeType != Node.ELEMENT_NODE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
updates.push(ParseUpdateNode(updateElement));
|
updates.push(parseUpdateNode(updateElement));
|
||||||
}
|
}
|
||||||
|
|
||||||
return updates;
|
return updates;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче