Bug 496917: Use extensionVersion when doing version comparisons. r=robstrong

This commit is contained in:
Dave Townsend 2009-06-15 20:32:32 +01:00
parent db2c57b96b
commit 5722b86bff
2 changed files with 10 additions and 10 deletions

View File

@ -1372,7 +1372,7 @@ UpdateService.prototype = {
getService(Ci.nsIVersionComparator);
for (var i = 0; i < updates.length; ++i) {
// Ignore updates for older versions of the application
if (vc.compare(updates[i].version, gApp.version) < 0)
if (vc.compare(updates[i].extensionVersion, gApp.version) < 0)
continue;
if (updates[i].type == "major" &&
vc.compare(newestMajor.version, updates[i].version) <= 0)
@ -1804,9 +1804,9 @@ UpdateService.prototype = {
getService(Ci.nsIVersionComparator);
// Don't download the update if the update's version is less than the
// current application's version.
if (update.version && vc.compare(update.version, ai.version) < 0) {
if (update.extensionVersion && vc.compare(update.extensionVersion, ai.version) < 0) {
LOG("UpdateService", "downloadUpdate - removing update for previous " +
"application version " + update.version);
"application version " + update.extensionVersion);
cleanupActiveUpdate();
return STATE_NONE;
}

View File

@ -249,13 +249,13 @@ function run_test_pt10() {
"e6678ca40ae7582316acdeddf3c133c9c8577de4",
"1316138");
var updates = getRemoteUpdateString(patches, "XPCShell App Update Test",
"minor", "1.0pre", "2.0",
"3.0", "20080811053724",
"minor", "version 1.0pre", "2.0",
"1.0pre", "20080811053724",
"http://dummylicense/index.html",
"http://dummydetails/index.html");
updates += getRemoteUpdateString(patches, "XPCShell App Update Test",
"minor", "1.0a", "2.0",
"3.0", "20080811053724",
"minor", "version 1.0a", "3.0",
"1.0a", "20080811053724",
"http://dummylicense/index.html",
"http://dummydetails/index.html");
gResponseBody = getRemoteUpdatesXMLString(updates);
@ -278,8 +278,8 @@ function run_test_pt11() {
"e6678ca40ae7582316acdeddf3c133c9c8577de4",
"1316138");
var updates = getRemoteUpdateString(patches, "XPCShell App Update Test",
"minor", "1.0", "2.0",
"3.0", "20080811053724",
"minor", "version 1.0", "3.0",
"1.0", "20080811053724",
"http://dummylicense/index.html",
"http://dummydetails/index.html");
gResponseBody = getRemoteUpdatesXMLString(updates);
@ -290,6 +290,6 @@ function run_test_pt11() {
function check_test_pt11() {
var bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
do_check_neq(bestUpdate, null);
do_check_eq(bestUpdate.version, "1.0");
do_check_eq(bestUpdate.version, "version 1.0");
end_test();
}