[Pkg-javascript-commits] [node-stream-http] 106/208: Check xhr.status is non-zero to avoid running onXHRProgress on error
Bastien Roucariès
rouca at moszumanska.debian.org
Sun Aug 13 13:39:33 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-stream-http.
commit 570f85ec18e63f3aea3b49c6685780cc585edb05
Author: John Hiesey <john at hiesey.com>
Date: Tue Oct 13 15:46:01 2015 -0700
Check xhr.status is non-zero to avoid running onXHRProgress on error
Previously, onXHRProgress was being run when readyState was being
set to DONE on error, which was causing exceptions.
---
lib/request.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/request.js b/lib/request.js
index 2702e7c..ce4179a 100644
--- a/lib/request.js
+++ b/lib/request.js
@@ -183,12 +183,14 @@ ClientRequest.prototype._onFinish = function () {
}
/**
- * Checks if xhr.status is readable. Even though the spec says it should
- * be available in readyState 3, accessing it throws an exception in IE8
+ * Checks if xhr.status is readable and non-zero, indicating no error.
+ * Even though the spec says it should be available in readyState 3,
+ * accessing it throws an exception in IE8
*/
function statusValid (xhr) {
try {
- return (xhr.status !== null)
+ var status = xhr.status
+ return (status !== null && status !== 0)
} catch (e) {
return false
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-http.git
More information about the Pkg-javascript-commits
mailing list