Skip to content

Commit

Permalink
Merge branch 'master' into iotests
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Oct 11, 2012
2 parents 94a741b + 6308872 commit 4a994dd
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 94 deletions.
139 changes: 70 additions & 69 deletions build/io-base/io-base-coverage.js

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions build/io-base/io-base-debug.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ IO.prototype = {
use; use;


if (alt === 'native') { 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. // external transport.
alt = Y.UA.ie ? 'xdr' : null; alt = Y.UA.ie && !SUPPORTS_CORS ? 'xdr' : null;


// Prevent "pre-flight" OPTIONS request by removing the // Prevent "pre-flight" OPTIONS request by removing the
// `X-Requested-With` HTTP header from CORS requests. This header // `X-Requested-With` HTTP header from CORS requests. This header
Expand Down Expand Up @@ -707,10 +707,8 @@ IO.prototype = {


// Will work only in browsers that implement the // Will work only in browsers that implement the
// Cross-Origin Resource Sharing draft. // Cross-Origin Resource Sharing draft.
if (config.xdr && config.xdr.credentials) { if (config.xdr && config.xdr.credentials && SUPPORTS_CORS) {
if (!Y.UA.ie) { transaction.c.withCredentials = true;
transaction.c.withCredentials = true;
}
} }


// Using "null" with HTTP POST will result in a request // Using "null" with HTTP POST will result in a request
Expand Down Expand Up @@ -908,7 +906,11 @@ Y.IO = IO;
Y.io._map = {}; Y.io._map = {};
var XHR = win && win.XMLHttpRequest, var XHR = win && win.XMLHttpRequest,
XDR = win && win.XDomainRequest, 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, { Y.mix(Y.IO, {
Expand Down
2 changes: 1 addition & 1 deletion build/io-base/io-base-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions build/io-base/io-base.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ IO.prototype = {
use; use;


if (alt === 'native') { 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. // external transport.
alt = Y.UA.ie ? 'xdr' : null; alt = Y.UA.ie && !SUPPORTS_CORS ? 'xdr' : null;


// Prevent "pre-flight" OPTIONS request by removing the // Prevent "pre-flight" OPTIONS request by removing the
// `X-Requested-With` HTTP header from CORS requests. This header // `X-Requested-With` HTTP header from CORS requests. This header
Expand Down Expand Up @@ -706,10 +706,8 @@ IO.prototype = {


// Will work only in browsers that implement the // Will work only in browsers that implement the
// Cross-Origin Resource Sharing draft. // Cross-Origin Resource Sharing draft.
if (config.xdr && config.xdr.credentials) { if (config.xdr && config.xdr.credentials && SUPPORTS_CORS) {
if (!Y.UA.ie) { transaction.c.withCredentials = true;
transaction.c.withCredentials = true;
}
} }


// Using "null" with HTTP POST will result in a request // Using "null" with HTTP POST will result in a request
Expand Down Expand Up @@ -906,7 +904,11 @@ Y.IO = IO;
Y.io._map = {}; Y.io._map = {};
var XHR = win && win.XMLHttpRequest, var XHR = win && win.XMLHttpRequest,
XDR = win && win.XDomainRequest, 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, { Y.mix(Y.IO, {
Expand Down
10 changes: 4 additions & 6 deletions src/io/js/io-base.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ IO.prototype = {
use; use;


if (alt === 'native') { 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. // external transport.
alt = Y.UA.ie ? 'xdr' : null; alt = Y.UA.ie && !SUPPORTS_CORS ? 'xdr' : null;


// Prevent "pre-flight" OPTIONS request by removing the // Prevent "pre-flight" OPTIONS request by removing the
// `X-Requested-With` HTTP header from CORS requests. This header // `X-Requested-With` HTTP header from CORS requests. This header
Expand Down Expand Up @@ -705,10 +705,8 @@ IO.prototype = {


// Will work only in browsers that implement the // Will work only in browsers that implement the
// Cross-Origin Resource Sharing draft. // Cross-Origin Resource Sharing draft.
if (config.xdr && config.xdr.credentials) { if (config.xdr && config.xdr.credentials && SUPPORTS_CORS) {
if (!Y.UA.ie) { transaction.c.withCredentials = true;
transaction.c.withCredentials = true;
}
} }


// Using "null" with HTTP POST will result in a request // Using "null" with HTTP POST will result in a request
Expand Down
6 changes: 5 additions & 1 deletion src/io/js/transports.js
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,10 @@
var XHR = win && win.XMLHttpRequest, var XHR = win && win.XMLHttpRequest,
XDR = win && win.XDomainRequest, 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, { Y.mix(Y.IO, {
Expand Down
2 changes: 1 addition & 1 deletion src/io/tests/unit/js/requests-tests.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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); this.wait(null, 1000);
} }
})); }));
Expand Down
4 changes: 2 additions & 2 deletions src/io/tests/unit/js/transport-tests.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ YUI.add('transport-tests', function(Y) {


suite.add(new Y.Test.Case({ suite.add(new Y.Test.Case({
name: 'Native Transport Test', 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(), var io = new Y.IO(),
o = io._create({ xdr: { use:'native' } }); o = io._create({ xdr: { use:'native' } });


// IE must use a form of external transport // 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); Y.Assert.isTrue(o.xdr);
} }
else { else {
Expand Down

0 comments on commit 4a994dd

Please sign in to comment.