From 67fdec20726e48ba3a934cb25bb30d47ec4a4f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20De=20La=20Pe=C3=B1a=20Smirnov?= Date: Wed, 29 Nov 2017 11:44:34 +0300 Subject: Initial commit, version 0.5.3 --- .../engine.io-client/lib/xmlhttprequest.js | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 node_modules/engine.io-client/lib/xmlhttprequest.js (limited to 'node_modules/engine.io-client/lib/xmlhttprequest.js') diff --git a/node_modules/engine.io-client/lib/xmlhttprequest.js b/node_modules/engine.io-client/lib/xmlhttprequest.js new file mode 100644 index 0000000..d76d9c7 --- /dev/null +++ b/node_modules/engine.io-client/lib/xmlhttprequest.js @@ -0,0 +1,37 @@ +// browser shim for xmlhttprequest module + +var hasCORS = require('has-cors'); + +module.exports = function (opts) { + var xdomain = opts.xdomain; + + // scheme must be same when usign XDomainRequest + // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx + var xscheme = opts.xscheme; + + // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default. + // https://github.com/Automattic/engine.io-client/pull/217 + var enablesXDR = opts.enablesXDR; + + // XMLHttpRequest can be disabled on IE + try { + if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { + return new XMLHttpRequest(); + } + } catch (e) { } + + // Use XDomainRequest for IE8 if enablesXDR is true + // because loading bar keeps flashing when using jsonp-polling + // https://github.com/yujiosaka/socke.io-ie8-loading-example + try { + if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) { + return new XDomainRequest(); + } + } catch (e) { } + + if (!xdomain) { + try { + return new global[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP'); + } catch (e) { } + } +}; -- cgit v1.2.3