]> source.dussan.org Git - jquery.git/commitdiff
Revert "Ajax: don't expect cross-origin tests run in envs which not support it"
authorOleg Gaidarenko <markelog@gmail.com>
Wed, 11 Nov 2015 15:54:44 +0000 (18:54 +0300)
committerOleg Gaidarenko <markelog@gmail.com>
Wed, 11 Nov 2015 15:54:44 +0000 (18:54 +0300)
This reverts commit 39cdb8c9aa0fde68f733553ba050a2ba9d86474c.

test/unit/ajax.js

index 4d7dc95e8970349eae34a9c4fd486ecd35d8ba65..4eb70cad892f5768f71e6dd7104208d078458603 100644 (file)
@@ -71,6 +71,21 @@ QUnit.module( "ajax", {
                };
        } );
 
+       ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) {
+               return {
+                       create: function( options ) {
+                               options.crossDomain = true;
+                               return jQuery.ajax( url( "data/script.php?header=ecma" ), options );
+                       },
+                       success: function() {
+                               assert.ok( true, "success" );
+                       },
+                       complete: function() {
+                               assert.ok( true, "complete" );
+                       }
+               };
+       } );
+
        ajaxTest( "jQuery.ajax() - execute js for crossOrigin when dataType option is provided", 3,
                function( assert ) {
                        return {
@@ -98,11 +113,6 @@ QUnit.module( "ajax", {
                        success: function() {
                                assert.ok( true, "success" );
                        },
-                       fail: function() {
-                               if (jQuery.support.cors === false) {
-                                       assert.ok( true, "fail" );
-                               }
-                       },
                        complete: function() {
                                assert.ok( true, "complete" );
                        }
@@ -1810,21 +1820,22 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
                        done: function( data ) {
                                assert.ok( false, "done: " + data );
                        },
-                       fail: function( jqXHR, status, error ) {
-                               assert.ok( true, "exception caught: " + error );
-                               assert.strictEqual( jqXHR.status, 0, "proper status code" );
-                               assert.strictEqual( status, "error", "proper status" );
-                       }
-               }, {
-                       url: "http://" + externalHost + ":80q",
-                       done: function( data ) {
-                               assert.ok( false, "done: " + data );
-                       },
-                       fail: function( _, status, error ) {
-                               assert.ok( true, "fail: " + status + " - " + error );
-                       }
-               } ];
-       } );
+                               fail: function( jqXHR, status, error ) {
+                                       assert.ok( true, "exception caught: " + error );
+                                       assert.strictEqual( jqXHR.status, 0, "proper status code" );
+                                       assert.strictEqual( status, "error", "proper status" );
+                               }
+                       }, {
+                               url: "http://domain.org:80d",
+                               done: function( data ) {
+                                       assert.ok( false, "done: " + data );
+                               },
+                               fail: function( _, status, error ) {
+                                       assert.ok( true, "fail: " + status + " - " + error );
+                               }
+                       } ];
+               }
+       );
 
        ajaxTest( "gh-2587 - when content-type not xml, but looks like one", 1, function( assert ) {
                return {