Skip to content

Commit 91e0eb7

Browse files
TimBeyerJames Halliday
authored andcommitted
Make sure to not call res.handle in case the request was aborted in IE9
1 parent 5d3407e commit 91e0eb7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/request.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ var Request = module.exports = function (xhr, params) {
5555
});
5656

5757
xhr.onreadystatechange = function () {
58+
// Fix for IE9 bug
59+
// SCRIPT575: Could not complete the operation due to error c00c023f
60+
// It happens when a request is aborted, calling the success callback anyway with readyState === 4
61+
if (xhr.__aborted) return;
5862
res.handle(xhr);
5963
};
6064
};
@@ -78,6 +82,7 @@ Request.prototype.write = function (s) {
7882
};
7983

8084
Request.prototype.destroy = function (s) {
85+
this.xhr.__aborted = true;
8186
this.xhr.abort();
8287
this.emit('close');
8388
};

0 commit comments

Comments
 (0)