aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2011-01-09 17:27:29 +0100
committerjaubourg <j@ubourg.net>2011-01-09 17:27:29 +0100
commit7bc538623077abb48d94b33ef8e389d1022b13af (patch)
tree16c37f00c5ad0de95c29676764a8a30e0276e7a3 /test
parent5a5f67800b048ae274e644547f4b8e03156ffa49 (diff)
downloadjquery-7bc538623077abb48d94b33ef8e389d1022b13af.tar.gz
jquery-7bc538623077abb48d94b33ef8e389d1022b13af.zip
Simplified cross-domain detection tests.
Diffstat (limited to 'test')
-rw-r--r--test/unit/ajax.js46
1 files changed, 13 insertions, 33 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 8bfd4d3e0..d849cff24 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -387,64 +387,44 @@ test("jQuery ajax - cross-domain detection", function() {
var loc = document.location,
otherPort = loc.port === 666 ? 667 : 666,
- otherProtocol = loc.protocol === "http:" ? "https:" : "http:",
- protocolFlag,
- hostFlag,
- portFlag,
- forcedFlag;
+ otherProtocol = loc.protocol === "http:" ? "https:" : "http:";
- if ( jQuery.ajax({
+ jQuery.ajax({
+ dataType: "jsonp",
url: otherProtocol + "//" + loc.host,
beforeSend: function( _ , s ) {
- protocolFlag = 1;
ok( s.crossDomain , "Test different protocols are detected as cross-domain" );
return false;
}
- }) === false ) {
- if ( ! protocolFlag ) {
- ok( ! jQuery.support.cors , "Test different protocols are detected as cross-domain (no transport)" );
- }
- }
+ });
- if ( jQuery.ajax({
+ jQuery.ajax({
+ dataType: "jsonp",
url: loc.protocol + '//somewebsitethatdoesnotexist-656329477541.com:' + ( loc.port || 80 ),
beforeSend: function( _ , s ) {
- hostFlag = 1;
ok( s.crossDomain , "Test different hostnames are detected as cross-domain" );
return false;
}
- }) === false ) {
- if ( ! hostFlag ) {
- ok( ! jQuery.support.cors , "Test different hostnames are detected as cross-domain (no transport)" );
- }
- }
+ });
- if ( jQuery.ajax({
+ jQuery.ajax({
+ dataType: "jsonp",
url: loc.protocol + "//" + loc.hostname + ":" + otherPort,
beforeSend: function( _ , s ) {
- portFlag = 1;
ok( s.crossDomain , "Test different ports are detected as cross-domain" );
return false;
}
- }) === false ) {
- if ( ! portFlag ) {
- ok( ! jQuery.support.cors , "Test different ports are detected as cross-domain (no transport)" );
- }
- }
+ });
- if ( jQuery.ajax({
+ jQuery.ajax({
+ dataType: "jsonp",
url: loc.protocol + "//" + loc.host,
crossDomain: true,
beforeSend: function( _ , s ) {
- forcedFlag = 1;
ok( s.crossDomain , "Test forced crossDomain is detected as cross-domain" );
return false;
}
- }) === false ) {
- if ( ! forcedFlag ) {
- ok( ! jQuery.support.cors , "Test forced crossDomain is detected as cross-domain (no transport)" );
- }
- }
+ });
});