Skip to content

Commit 94a27f1

Browse files
committed
1) add events 'error' and 'abort'
2) the status property must return 0 if the error flag is set
1 parent 17b03f9 commit 94a27f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/XMLHttpRequest.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,12 @@ exports.XMLHttpRequest = function() {
509509
* Called when an error is encountered to deal with it.
510510
*/
511511
this.handleError = function(error) {
512-
this.status = 503;
512+
this.status = 0;
513513
this.statusText = error;
514514
this.responseText = error.stack;
515515
errorFlag = true;
516516
setState(this.DONE);
517+
this.dispatchEvent('error');
517518
};
518519

519520
/**
@@ -526,6 +527,7 @@ exports.XMLHttpRequest = function() {
526527
}
527528

528529
headers = defaultHeaders;
530+
this.status = 0;
529531
this.responseText = "";
530532
this.responseXML = "";
531533

@@ -538,6 +540,7 @@ exports.XMLHttpRequest = function() {
538540
setState(this.DONE);
539541
}
540542
this.readyState = this.UNSENT;
543+
this.dispatchEvent('abort');
541544
};
542545

543546
/**

0 commit comments

Comments
 (0)