[Pkg-javascript-commits] [sockjs-client] 367/434: #51 - IE10 should use xhr before xdr

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:25 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 62791b7a4e98e33260a19c21a57f43fec43510de
Author: Marek Majkowski <majek04 at gmail.com>
Date:   Fri Mar 16 16:07:43 2012 +0000

    #51 - IE10 should use xhr before xdr
    
    To be similar to other browsers. Also, to avoid the xdr cookie issues.
---
 lib/utils.js                    | 16 ++++++++--------
 tests/html/src/unittests.coffee | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/lib/utils.js b/lib/utils.js
index 7dbc69c..ec1e424 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -283,11 +283,11 @@ utils.detectProtocols = function(probed, protocols_whitelist, info) {
     }
 
     // 2. Streaming
-    if (pe['xdr-streaming'] && !info.cookie_needed && !info.null_origin) {
-        protocols.push('xdr-streaming');
+    if (pe['xhr-streaming'] && !info.null_origin) {
+        protocols.push('xhr-streaming');
     } else {
-        if (pe['xhr-streaming'] && !info.null_origin) {
-            protocols.push('xhr-streaming');
+        if (pe['xdr-streaming'] && !info.cookie_needed && !info.null_origin) {
+            protocols.push('xdr-streaming');
         } else {
             maybe_push(['iframe-eventsource',
                         'iframe-htmlfile']);
@@ -295,11 +295,11 @@ utils.detectProtocols = function(probed, protocols_whitelist, info) {
     }
 
     // 3. Polling
-    if (pe['xdr-polling'] && !info.cookie_needed && !info.null_origin) {
-        protocols.push('xdr-polling');
+    if (pe['xhr-polling'] && !info.null_origin) {
+        protocols.push('xhr-polling');
     } else {
-        if (pe['xhr-polling'] && !info.null_origin) {
-            protocols.push('xhr-polling');
+        if (pe['xdr-polling'] && !info.cookie_needed && !info.null_origin) {
+            protocols.push('xdr-polling');
         } else {
             maybe_push(['iframe-xhr-polling',
                         'jsonp-polling']);
diff --git a/tests/html/src/unittests.coffee b/tests/html/src/unittests.coffee
index b1b0fee..36132bd 100644
--- a/tests/html/src/unittests.coffee
+++ b/tests/html/src/unittests.coffee
@@ -176,6 +176,22 @@ test 'detectProtocols', ->
             ['xdr-streaming', 'xdr-polling'])
     deepEqual(u.detectProtocols(ie8_probed, null, {cookie_needed:true}),
             ['iframe-htmlfile', 'iframe-xhr-polling'])
+    # IE 10
+    ie10_probed = {
+        'websocket': true
+        'xdr-streaming': true
+        'xhr-streaming': true
+        'iframe-eventsource': false
+        'iframe-htmlfile': true
+        'xdr-polling': true
+        'xhr-polling': true
+        'iframe-xhr-polling': true
+        'jsonp-polling': true
+    }
+    deepEqual(u.detectProtocols(ie10_probed, null, {}),
+            ['websocket', 'xhr-streaming', 'xhr-polling'])
+    deepEqual(u.detectProtocols(ie10_probed, null, {cookie_needed:true}),
+            ['websocket', 'xhr-streaming', 'xhr-polling'])
 
     # Check if protocols are picked up correctly when served from file://
     deepEqual(u.detectProtocols(chrome_probed, null, {null_origin:true}),
@@ -191,6 +207,8 @@ test 'detectProtocols', ->
             ['jsonp-polling'])
     deepEqual(u.detectProtocols(ie8_probed, null, {null_origin:true}),
             ['iframe-htmlfile', 'iframe-xhr-polling'])
+    deepEqual(u.detectProtocols(ie10_probed, null, {null_origin:true}),
+            ['websocket', 'iframe-htmlfile', 'iframe-xhr-polling'])
 
 test "EventEmitter", ->
     expect(4)

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