I am working on creating an AJAX request from a Firefox extension. I have this code:
function GetMenu(){ var oReq = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(); // Setup event handlers - must be set before calling open() oReq.addEventListener("progress", updateProgress, false); oReq.addEventListener("load", transferComplete, false); oReq.addEventListener("error", transferFailed, false); oReq.addEventListener("abort", transferCanceled, false); oReq.open('POST', "http://www.foo.bar/", true); oReq.send('your=data&and=more&stuff=here'); } function transferFailed(evt) { Application.console.log("An error occurred while transferring the file."); Application.console.log(this.responseText); for(var i in evt) Application.console.log(i+ ' => '+evt[i]); }
The request fails because http://www.foo.bar/ does not exist (I suppose). My question is: why is there no error message in the evt object passed to transferFailed () that says: “Domain does not exist” or “DNS error” or something like that? None of the properties of the event object have any signs that the problem is, there is no message, error code, etc.
Should there be some indication of what the actual error is?
source share