diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2012-10-03 08:26:01 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-10-03 21:07:50 -0400 |
commit | da3ff3afe4d8421ae4ad04d6653f04ed6d7768e3 (patch) | |
tree | c1c71c271421d4adbd52fd2035ac4e9f034a106d /test/unit/ajax.js | |
parent | ebf4d43011b7a6add9ded38b4322163f8b030cb6 (diff) | |
download | jquery-da3ff3afe4d8421ae4ad04d6653f04ed6d7768e3.tar.gz jquery-da3ff3afe4d8421ae4ad04d6653f04ed6d7768e3.zip |
Fix #12637: restore 1.8.1 ajax crossDomain logic. Close gh-944.
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r-- | test/unit/ajax.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 1345eae3a..d78bca656 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -511,14 +511,24 @@ test(".ajax() - hash", function() { test("jQuery ajax - cross-domain detection", function() { - expect( 6 ); + expect( 7 ); var loc = document.location, + samePort = loc.port || ( loc.protocol === "http:" ? 80 : 443 ), otherPort = loc.port === 666 ? 667 : 666, otherProtocol = loc.protocol === "http:" ? "https:" : "http:"; jQuery.ajax({ dataType: "jsonp", + url: loc.protocol + "//" + loc.host + ":" + samePort, + beforeSend: function( _ , s ) { + ok( !s.crossDomain , "Test matching ports are not detected as cross-domain" ); + return false; + } + }); + + jQuery.ajax({ + dataType: "jsonp", url: otherProtocol + "//" + loc.host, beforeSend: function( _ , s ) { ok( s.crossDomain , "Test different protocols are detected as cross-domain" ); |