aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/httpBackend.js
diff options
context:
space:
mode:
authorTobias Bosch2014-01-02 14:37:48 -0800
committerTobias Bosch2014-01-02 14:37:48 -0800
commit4f57236614415eea919221ea5f99c4d8689b3267 (patch)
tree558b8feae310f5bcb72b84ad57e45db9c82e48a2 /src/ng/httpBackend.js
parent50bf029625d603fc652f0f413e709f43803743db (diff)
downloadangular.js-4f57236614415eea919221ea5f99c4d8689b3267.tar.bz2
fix($httpBackend): Ignore multiple calls to onreadystatechange with readyState=4
On mobile webkit `onreadystatechange` might by called multiple times with `readyState===4` caused by xhrs that are resolved while the app is in the background. Fixes #5426.
Diffstat (limited to 'src/ng/httpBackend.js')
-rw-r--r--src/ng/httpBackend.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js
index 0a0e1f71..0bfe2fc3 100644
--- a/src/ng/httpBackend.js
+++ b/src/ng/httpBackend.js
@@ -70,6 +70,11 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument)
// always async
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
+ // onreadystatechange might by called multiple times
+ // with readyState === 4 on mobile webkit caused by
+ // xhrs that are resolved while the app is in the background (see #5426).
+ xhr.onreadystatechange = undefined;
+
var responseHeaders = null,
response = null;