diff --git a/lib/XMLHttpRequest.js b/lib/XMLHttpRequest.js index 949fdf9..1358173 100644 --- a/lib/XMLHttpRequest.js +++ b/lib/XMLHttpRequest.js @@ -509,11 +509,12 @@ exports.XMLHttpRequest = function() { * Called when an error is encountered to deal with it. */ this.handleError = function(error) { - this.status = 503; + this.status = 0; this.statusText = error; this.responseText = error.stack; errorFlag = true; setState(this.DONE); + this.dispatchEvent('error'); }; /** @@ -526,6 +527,7 @@ exports.XMLHttpRequest = function() { } headers = defaultHeaders; + this.status = 0; this.responseText = ""; this.responseXML = ""; @@ -538,6 +540,7 @@ exports.XMLHttpRequest = function() { setState(this.DONE); } this.readyState = this.UNSENT; + this.dispatchEvent('abort'); }; /**