Skip to content

Commit

Permalink
Revert "Ajax: Mitigate possible XSS vulnerability"
Browse files Browse the repository at this point in the history
This reverts commit f60729f.

Fixes gh-3011
Refs ad358fd
  • Loading branch information
mgol committed Mar 23, 2016
1 parent 22ce99a commit cfe830e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
7 changes: 0 additions & 7 deletions src/ajax/script.js
Expand Up @@ -4,13 +4,6 @@ define( [
"../ajax"
], function( jQuery, document ) {

// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter( function( s ) {
if ( s.crossDomain ) {
s.contents.script = false;
}
} );

// Install script dataType
jQuery.ajaxSetup( {
accepts: {
Expand Down
38 changes: 0 additions & 38 deletions test/unit/ajax.js
Expand Up @@ -85,44 +85,6 @@ QUnit.module( "ajax", {
};
} );

ajaxTest( "jQuery.ajax() - execute js for crossOrigin when dataType option is provided", 3,
function( assert ) {
return {
create: function( options ) {
options.crossDomain = true;
options.dataType = "script";
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() - do not execute js (crossOrigin)", 2, function( assert ) {
return {
create: function( options ) {
options.crossDomain = true;
return jQuery.ajax( url( "data/script.php" ), options );
},
success: function() {
assert.ok( true, "success" );
},
fail: function() {
if ( jQuery.support.cors === false ) {
assert.ok( true, "fail" );
}
},
complete: function() {
assert.ok( true, "complete" );
}
};
} );

ajaxTest( "jQuery.ajax() - success callbacks (late binding)", 8, function( assert ) {
return {
setup: addGlobalEvents( "ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess", assert ),
Expand Down

4 comments on commit cfe830e

@jessewunder
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly was broken with the inclusion of this code?

@dmethvin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See gh-3011. Please don't comment on long-closed PRs and tickets.

@jessewunder
Copy link

@jessewunder jessewunder commented on cfe830e May 11, 2018 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmethvin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I linked to gh-3011 is that it is the first link in the commit above, so it have been easy to find. The very first link in gh-3011 is to the issue #2432 (comment) which should make the issue clear enough.

Please sign in to comment.