Skip to content

Commit 8dda094

Browse files
committed
Revert "Ajax: don't expect cross-origin tests run in envs which not support it"
This reverts commit 39cdb8c.
1 parent 3f7cd73 commit 8dda094

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

test/unit/ajax.js

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@ QUnit.module( "ajax", {
7171
};
7272
} );
7373

74+
ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) {
75+
return {
76+
create: function( options ) {
77+
options.crossDomain = true;
78+
return jQuery.ajax( url( "data/script.php?header=ecma" ), options );
79+
},
80+
success: function() {
81+
assert.ok( true, "success" );
82+
},
83+
complete: function() {
84+
assert.ok( true, "complete" );
85+
}
86+
};
87+
} );
88+
7489
ajaxTest( "jQuery.ajax() - execute js for crossOrigin when dataType option is provided", 3,
7590
function( assert ) {
7691
return {
@@ -98,11 +113,6 @@ QUnit.module( "ajax", {
98113
success: function() {
99114
assert.ok( true, "success" );
100115
},
101-
fail: function() {
102-
if (jQuery.support.cors === false) {
103-
assert.ok( true, "fail" );
104-
}
105-
},
106116
complete: function() {
107117
assert.ok( true, "complete" );
108118
}
@@ -1810,21 +1820,22 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
18101820
done: function( data ) {
18111821
assert.ok( false, "done: " + data );
18121822
},
1813-
fail: function( jqXHR, status, error ) {
1814-
assert.ok( true, "exception caught: " + error );
1815-
assert.strictEqual( jqXHR.status, 0, "proper status code" );
1816-
assert.strictEqual( status, "error", "proper status" );
1817-
}
1818-
}, {
1819-
url: "http://" + externalHost + ":80q",
1820-
done: function( data ) {
1821-
assert.ok( false, "done: " + data );
1822-
},
1823-
fail: function( _, status, error ) {
1824-
assert.ok( true, "fail: " + status + " - " + error );
1825-
}
1826-
} ];
1827-
} );
1823+
fail: function( jqXHR, status, error ) {
1824+
assert.ok( true, "exception caught: " + error );
1825+
assert.strictEqual( jqXHR.status, 0, "proper status code" );
1826+
assert.strictEqual( status, "error", "proper status" );
1827+
}
1828+
}, {
1829+
url: "http://domain.org:80d",
1830+
done: function( data ) {
1831+
assert.ok( false, "done: " + data );
1832+
},
1833+
fail: function( _, status, error ) {
1834+
assert.ok( true, "fail: " + status + " - " + error );
1835+
}
1836+
} ];
1837+
}
1838+
);
18281839

18291840
ajaxTest( "gh-2587 - when content-type not xml, but looks like one", 1, function( assert ) {
18301841
return {

0 commit comments

Comments
 (0)