[Pkg-javascript-commits] [sockjs-client] 107/434: IE doesn't like peeking into responseText and status on readyState=3.
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:07 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository sockjs-client.
commit 1fa87b1eb7394f6198d398635edb6682645c8be8
Author: Marek Majkowski <majek04 at gmail.com>
Date: Thu Aug 25 17:13:37 2011 +0100
IE doesn't like peeking into responseText and status on readyState=3.
---
lib/trans-receiver-xhr.js | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/lib/trans-receiver-xhr.js b/lib/trans-receiver-xhr.js
index fe97155..8b4bd1a 100644
--- a/lib/trans-receiver-xhr.js
+++ b/lib/trans-receiver-xhr.js
@@ -1,18 +1,25 @@
-var XhrCorsReceiver = function(url) {
+var XhrReceiver = function(url, opts) {
var that = this;
var buf_pos = 0;
var orsc = function (xhr, e, abort_reason) {
- if ((xhr.readyState === 3 || xhr.readyState === 4) &&
- xhr.responseText && xhr.status === 200) {
- var msgs = [];
- while (1) {
- var buf = xhr.responseText.slice(buf_pos);
- var p = buf.indexOf('\n');
- if (p === -1) break;
- buf_pos += p+1;
- var msg = buf.slice(0, p);
- that.dispatchEvent(new SimpleEvent('message', {'data': msg}));
+ if (xhr.readyState === 3 || xhr.readyState === 4) {
+ // IE doesn't like peeking into responseText or status on
+ // readystate=3
+ try {
+ var responseText = xhr.responseText;
+ var status = xhr.status;
+ } catch (x) {}
+ if (responseText && status === 200) {
+ var msgs = [];
+ while (1) {
+ var buf = responseText.slice(buf_pos);
+ var p = buf.indexOf('\n');
+ if (p === -1) break;
+ buf_pos += p+1;
+ var msg = buf.slice(0, p);
+ that.dispatchEvent(new SimpleEvent('message', {'data': msg}));
+ }
}
}
if (xhr.readyState === 4 || abort_reason) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list