Permalink
Browse files

Merge branch 'master' into iotests

  • Loading branch information...
2 parents 94a741b + 6308872 commit 4a994dd77c7ed79b59bd9245f95ba8c7988d36ed @davglass davglass committed Oct 11, 2012
Oops, something went wrong.
@@ -115,9 +115,9 @@ IO.prototype = {
use;
if (alt === 'native') {
- // Non-IE can use XHR level 2 and not rely on an
+ // Non-IE and IE >= 10 can use XHR level 2 and not rely on an
// external transport.
- alt = Y.UA.ie ? 'xdr' : null;
+ alt = Y.UA.ie && !SUPPORTS_CORS ? 'xdr' : null;
// Prevent "pre-flight" OPTIONS request by removing the
// `X-Requested-With` HTTP header from CORS requests. This header
@@ -707,10 +707,8 @@ IO.prototype = {
// Will work only in browsers that implement the
// Cross-Origin Resource Sharing draft.
- if (config.xdr && config.xdr.credentials) {
- if (!Y.UA.ie) {
- transaction.c.withCredentials = true;
- }
+ if (config.xdr && config.xdr.credentials && SUPPORTS_CORS) {
+ transaction.c.withCredentials = true;
}
// Using "null" with HTTP POST will result in a request
@@ -908,7 +906,11 @@ Y.IO = IO;
Y.io._map = {};
var XHR = win && win.XMLHttpRequest,
XDR = win && win.XDomainRequest,
- AX = win && win.ActiveXObject;
+ AX = win && win.ActiveXObject,
+
+ // Checks for the presence of the `withCredentials` in an XHR instance
+ // object, which will be present if the environment supports CORS.
+ SUPPORTS_CORS = XHR && 'withCredentials' in (new XMLHttpRequest());
Y.mix(Y.IO, {
Oops, something went wrong.
View
@@ -115,9 +115,9 @@ IO.prototype = {
use;
if (alt === 'native') {
- // Non-IE can use XHR level 2 and not rely on an
+ // Non-IE and IE >= 10 can use XHR level 2 and not rely on an
// external transport.
- alt = Y.UA.ie ? 'xdr' : null;
+ alt = Y.UA.ie && !SUPPORTS_CORS ? 'xdr' : null;
// Prevent "pre-flight" OPTIONS request by removing the
// `X-Requested-With` HTTP header from CORS requests. This header
@@ -706,10 +706,8 @@ IO.prototype = {
// Will work only in browsers that implement the
// Cross-Origin Resource Sharing draft.
- if (config.xdr && config.xdr.credentials) {
- if (!Y.UA.ie) {
- transaction.c.withCredentials = true;
- }
+ if (config.xdr && config.xdr.credentials && SUPPORTS_CORS) {
+ transaction.c.withCredentials = true;
}
// Using "null" with HTTP POST will result in a request
@@ -906,7 +904,11 @@ Y.IO = IO;
Y.io._map = {};
var XHR = win && win.XMLHttpRequest,
XDR = win && win.XDomainRequest,
- AX = win && win.ActiveXObject;
+ AX = win && win.ActiveXObject,
+
+ // Checks for the presence of the `withCredentials` in an XHR instance
+ // object, which will be present if the environment supports CORS.
+ SUPPORTS_CORS = XHR && 'withCredentials' in (new XMLHttpRequest());
Y.mix(Y.IO, {
View
@@ -113,9 +113,9 @@ IO.prototype = {
use;
if (alt === 'native') {
- // Non-IE can use XHR level 2 and not rely on an
+ // Non-IE and IE >= 10 can use XHR level 2 and not rely on an
// external transport.
- alt = Y.UA.ie ? 'xdr' : null;
+ alt = Y.UA.ie && !SUPPORTS_CORS ? 'xdr' : null;
// Prevent "pre-flight" OPTIONS request by removing the
// `X-Requested-With` HTTP header from CORS requests. This header
@@ -705,10 +705,8 @@ IO.prototype = {
// Will work only in browsers that implement the
// Cross-Origin Resource Sharing draft.
- if (config.xdr && config.xdr.credentials) {
- if (!Y.UA.ie) {
- transaction.c.withCredentials = true;
- }
+ if (config.xdr && config.xdr.credentials && SUPPORTS_CORS) {
+ transaction.c.withCredentials = true;
}
// Using "null" with HTTP POST will result in a request
View
@@ -1,6 +1,10 @@
var XHR = win && win.XMLHttpRequest,
XDR = win && win.XDomainRequest,
- AX = win && win.ActiveXObject;
+ AX = win && win.ActiveXObject,
+
+ // Checks for the presence of the `withCredentials` in an XHR instance
+ // object, which will be present if the environment supports CORS.
+ SUPPORTS_CORS = XHR && 'withCredentials' in (new XMLHttpRequest());
Y.mix(Y.IO, {
@@ -55,7 +55,7 @@ YUI.add('requests-tests', function(Y) {
}
}
};
- Y.io(Y.IO.URLS.delete + '?hello=world&foo=bar', cb);
+ Y.io(Y.IO.URLS['delete'] + '?hello=world&foo=bar', cb);
this.wait(null, 1000);
}
}));
@@ -21,12 +21,12 @@ YUI.add('transport-tests', function(Y) {
suite.add(new Y.Test.Case({
name: 'Native Transport Test',
- 'Non-IE browsers should be able to use XHR level 2': function() {
+ 'Non-IE browsers and IE >= 10 should be able to use XHR level 2': function() {
var io = new Y.IO(),
o = io._create({ xdr: { use:'native' } });
// IE must use a form of external transport
- if (Y.UA.ie) {
+ if (Y.UA.ie && Y.UA.ie < 10) {
Y.Assert.isTrue(o.xdr);
}
else {

0 comments on commit 4a994dd

Please sign in to comment.