From cfe830eefdd7f1e7cb87e9841d1d732d6d99ffae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82=C4=99biowski?= Date: Wed, 23 Mar 2016 12:44:29 +0100 Subject: [PATCH] Revert "Ajax: Mitigate possible XSS vulnerability" This reverts commit f60729f3903d17917dc351f3ac87794de379b0cc. Fixes gh-3011 Refs ad358fd62b0ab548abe379594ea00441940461f6 --- src/ajax/script.js | 7 ------- test/unit/ajax.js | 38 -------------------------------------- 2 files changed, 45 deletions(-) diff --git a/src/ajax/script.js b/src/ajax/script.js index 9167b0462..1aa4dbfbd 100644 --- a/src/ajax/script.js +++ b/src/ajax/script.js @@ -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: { diff --git a/test/unit/ajax.js b/test/unit/ajax.js index d74909f88..deeae452d 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -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 ), -- 2.39.5