aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSean Robinson <sean.robinson@scottsdalecc.edu>2019-04-26 07:25:08 -0700
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-09-26 02:43:30 +0200
commit50871a5a85cc802421b40cc67e2830601968affe (patch)
tree2c8ad39a147d2a52b0e979b408e8a764f5773da9 /src
parent9df4f1de12728b44a4b0f91748f12421008d9079 (diff)
downloadjquery-50871a5a85cc802421b40cc67e2830601968affe.tar.gz
jquery-50871a5a85cc802421b40cc67e2830601968affe.zip
Ajax: Do not execute scripts for unsuccessful HTTP responses
The script transport used to evaluate fetched script sources which is undesirable for unsuccessful HTTP responses. This is different to other data types where such a convention was fine (e.g. in case of JSON). Fixes gh-4250 Closes gh-4379
Diffstat (limited to 'src')
-rw-r--r--src/ajax.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ajax.js b/src/ajax.js
index c1f7b14d9..53557253f 100644
--- a/src/ajax.js
+++ b/src/ajax.js
@@ -748,6 +748,11 @@ jQuery.extend( {
response = ajaxHandleResponses( s, jqXHR, responses );
}
+ // Use a noop converter for missing script
+ if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
+ s.converters[ "text script" ] = function() {};
+ }
+
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );