Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Back out the try/catch logic from around JSON.parse. We should always…

… try to use it, otherwise security will suffer.
  • Loading branch information...
commit c14fa516ae5525f93af562910d22f0a836ebdde3 1 parent c68fbc2
@jeresig jeresig authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/ajax.js
View
6 src/ajax.js
@@ -578,10 +578,10 @@ jQuery.extend({
// Get the JavaScript object, if JSON is used.
if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
// Try to use the native JSON parser first
- try {
- data = JSON.parse( data );
+ if ( window.JSON && window.JSON.parse ) {
+ data = window.JSON.parse( data );
- } catch(e) {
+ } else {
data = (new Function("return " + data))();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.