javascript - Shouldn't the error event of xmlhttprequest have an error message? -


i'm working on making ajax request firefox extension. have code:

function getmenu(){    var oreq = components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance();     // setup event handlers - must 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 file.");   application.console.log(this.responsetext);   for(var in evt)           application.console.log(i+ ' => '+evt[i]); } 

the request fails because http://www.foo.bar/ not exist (i assume). question is, why there no error message in evt object passed transferfailed() says, "the domain not exist" or "dns failure" or of nature? none of event object's properties have indication of problem is, no message, no error code, etc.

shouldn't there sort of indication of actual error is?

since you're running chrome-privileges:

function transferfailed(evt) {  if (this.channel && this.channel.status == components.results.ns_error_unknown_host) {    alert("dns error");  } } 

(what @paa said in comment).

see (you might need queryinterface/instanceof accordingly):


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -