Permalink
Browse files

Bug 655162: A missing updates property in an update.rdf should be cou…

…nted as no available updates not as a failure to check for updates. r=robstrong a=asa
  • Loading branch information...
1 parent 7fbf127 commit 21685e3c0062f626036d460bc6e9e6f90b283991 @Mossop Mossop committed May 23, 2011
@@ -332,7 +332,14 @@ function parseRDFManifest(aId, aType, aUpdateKey, aRequest) {
let updates = ds.GetTarget(extensionRes, EM_R("updates"), true);
- if (!updates || !(updates instanceof Ci.nsIRDFResource))
+ // A missing updates property doesn't count as a failure, just as no avialable
+ // update information
+ if (!updates) {
+ WARN("Update manifest for " + aId + " did not contain an updates property");
+ return [];
+ }
+
+ if (!(updates instanceof Ci.nsIRDFResource))
throw new Error("Missing updates property for " + extensionRes.Value);
let cu = Cc["@mozilla.org/rdf/container-utils;1"].
@@ -289,4 +289,11 @@
CoXz50r3rYPcYz4WS+7/+lvrUqsuWd9Wj+q0NeCPiNaaro6/AolE2Qf5JFRL3lxY
lsKWAnVO</em:signature>
</RDF:Description>
+
+ <!-- There should be no information present for test_bug378216_14 -->
+
+ <!-- Invalid update RDF -->
+ <RDF:Description about="urn:mozilla:extension:test_bug378216_15@tests.mozilla.org">
+ <em:updates>Foo</em:updates>
+ </RDF:Description>
</RDF>
@@ -192,11 +192,41 @@ function run_test_9() {
do_check_eq(updates.length, 1);
do_check_eq(updates[0].version, "2.0");
do_check_true("updateURL" in updates[0]);
- end_test();
+ run_test_10();
+ },
+
+ onUpdateCheckError: function(status) {
+ do_throw("Update check failed with status " + status);
+ }
+ });
+}
+
+function run_test_10() {
+ AddonUpdateChecker.checkForUpdates("test_bug378216_14@tests.mozilla.org",
+ "extension", null,
+ "http://localhost:4444/data/test_updatecheck.rdf", {
+ onUpdateCheckComplete: function(updates) {
+ do_check_eq(updates.length, 0);
+ run_test_11();
},
onUpdateCheckError: function(status) {
do_throw("Update check failed with status " + status);
}
});
}
+
+function run_test_11() {
+ AddonUpdateChecker.checkForUpdates("test_bug378216_15@tests.mozilla.org",
+ "extension", null,
+ "http://localhost:4444/data/test_updatecheck.rdf", {
+ onUpdateCheckComplete: function(updates) {
+ do_throw("Update check should have failed");
+ },
+
+ onUpdateCheckError: function(status) {
+ do_check_eq(status, AddonUpdateChecker.ERROR_PARSE_ERROR);
+ end_test();
+ }
+ });
+}

0 comments on commit 21685e3

Please sign in to comment.