[Pkg-javascript-commits] [sockjs-client] 01/350: Fix XhrStreamingTransport.enabled for IE 8

tonnerre at ancient-solutions.com tonnerre at ancient-solutions.com
Fri Aug 5 01:02:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.

commit a11ec1e164cd6389913df711d92f7d8481aa0664
Author: Marco Süß <shiftmeta at googlemail.com>
Date:   Thu Aug 9 19:57:32 2012 +0300

    Fix XhrStreamingTransport.enabled for IE 8
    
    This dies with "Object does not support this property or method" om IE8. This is a quick fix to make sockjs work, but I don't know if it's correct. Discuss?
---
 lib/trans-xhr.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/trans-xhr.js b/lib/trans-xhr.js
index 7594290..417a9c9 100644
--- a/lib/trans-xhr.js
+++ b/lib/trans-xhr.js
@@ -37,9 +37,14 @@ XhrStreamingTransport.prototype = new AjaxBasedTransport();
 XhrStreamingTransport.enabled = function() {
     // Support for CORS Ajax aka Ajax2? Opera 12 claims CORS but
     // doesn't do streaming.
-    return (_window.XMLHttpRequest &&
-            'withCredentials' in new XMLHttpRequest() &&
-            (!/opera/i.test(navigator.userAgent)));
+    try {
+        return (_window.XMLHttpRequest &&
+                'withCredentials' in new XMLHttpRequest() &&
+                (!/opera/i.test(navigator.userAgent)));                                        
+    }
+    catch (ignored) {
+        return false;
+    }
 };
 XhrStreamingTransport.roundTrips = 2; // preflight, ajax
 

-- 
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