From 4dd0e01709de4d325ff116b76fe5679e0046a492 Mon Sep 17 00:00:00 2001 From: Lucian Pacurar Date: Sat, 19 Oct 2013 19:17:51 +0300 Subject: [PATCH 1/2] fix($httpBackend): Fix for IE9 AJAX request aborting error. --- src/ng/httpBackend.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 55ea56079460..6cb36061d90e 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -66,6 +66,14 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, // always async xhr.onreadystatechange = function() { if (xhr.readyState == 4) { + + // Aborting AJAX requests in IE9 makes the XHR object's properties inaccessible and throws the following error: + // SCRIPT575: Could not complete the operation due to error c00c023f. + if (msie && msie == 9 && xhr.aborted) { + completeRequest(callback, 0, "", ""); + return; + } + var responseHeaders = xhr.getAllResponseHeaders(); // responseText is the old-school way of retrieving response (supported by IE8 & 9) @@ -98,6 +106,7 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, function timeoutRequest() { status = -1; jsonpDone && jsonpDone(); + xhr && msie && msie == 9 && (xhr.aborted = true); xhr && xhr.abort(); } From 615acceb6bd9648bd5260c4698b69ba780ca7e43 Mon Sep 17 00:00:00 2001 From: Lucian Pacurar Date: Sat, 19 Oct 2013 19:17:51 +0300 Subject: [PATCH 2/2] fix($httpBackend): Fix for IE9 AJAX request aborting error. --- src/ng/httpBackend.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 55ea56079460..6cb36061d90e 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -66,6 +66,14 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, // always async xhr.onreadystatechange = function() { if (xhr.readyState == 4) { + + // Aborting AJAX requests in IE9 makes the XHR object's properties inaccessible and throws the following error: + // SCRIPT575: Could not complete the operation due to error c00c023f. + if (msie && msie == 9 && xhr.aborted) { + completeRequest(callback, 0, "", ""); + return; + } + var responseHeaders = xhr.getAllResponseHeaders(); // responseText is the old-school way of retrieving response (supported by IE8 & 9) @@ -98,6 +106,7 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, function timeoutRequest() { status = -1; jsonpDone && jsonpDone(); + xhr && msie && msie == 9 && (xhr.aborted = true); xhr && xhr.abort(); }