mozilla/openwebapps — Issue #117: fetching of manifests in owa extension
Author: dclarke
Created: 2011-10-13 01:11:22+00:00
State: open

function fetchManifest(url, cb) {
dump("APPS | api.install.fetchManifest | Fetching manifest from " + url + "\n");
// contact our server to retrieve the URL
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(Ci.nsIXMLHttpRequest);
xhr.open("GET", url, true);
xhr.onreadystatechange = function(aEvt) {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
dump("APPS | api.install.fetchManifest | Got manifest (200) " + xhr.responseText.length + " bytes\n");
cb(xhr.responseText, xhr.getResponseHeader('Content-Type'));
} else {
dump("Failed to get manifest (" + xhr.status + ")\n");
cb(null);
}
}
};
xhr.send(null);
}

This is the code, basically I worry that this isn't behind a try / catch, as well as a timeout behind this call to abort xhr.