git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make it so prefilters get access to the original settings.
[jquery.git]
/
test
/
unit
/
ajax.js
diff --git
a/test/unit/ajax.js
b/test/unit/ajax.js
index
4c8c500
..
d849cff
100644
(file)
--- a/
test/unit/ajax.js
+++ b/
test/unit/ajax.js
@@
-383,53
+383,48
@@
test(".ajax() - hash", function() {
test("jQuery ajax - cross-domain detection", function() {
test("jQuery ajax - cross-domain detection", function() {
- expect( 3 );
+ expect( 4 );
var loc = document.location,
otherPort = loc.port === 666 ? 667 : 666,
var loc = document.location,
otherPort = loc.port === 666 ? 667 : 666,
- otherProtocol = loc.protocol === "http:" ? "https:" : "http:",
- protocolFlag,
- hostFlag,
- portFlag;
+ otherProtocol = loc.protocol === "http:" ? "https:" : "http:";
- if ( jQuery.ajax({
+ jQuery.ajax({
+ dataType: "jsonp",
url: otherProtocol + "//" + loc.host,
beforeSend: function( _ , s ) {
url: otherProtocol + "//" + loc.host,
beforeSend: function( _ , s ) {
- protocolFlag = 1;
ok( s.crossDomain , "Test different protocols are detected as cross-domain" );
return false;
}
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 ) {
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;
}
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 ) {
url: loc.protocol + "//" + loc.hostname + ":" + otherPort,
beforeSend: function( _ , s ) {
- portFlag = 1;
ok( s.crossDomain , "Test different ports are detected as cross-domain" );
return false;
}
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)" );
+ });
+
+ jQuery.ajax({
+ dataType: "jsonp",
+ url: loc.protocol + "//" + loc.host,
+ crossDomain: true,
+ beforeSend: function( _ , s ) {
+ ok( s.crossDomain , "Test forced crossDomain is detected as cross-domain" );
+ return false;
}
}
- }
+ });
});
});