aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-01-07 11:54:26 -0500
committerjeresig <jeresig@gmail.com>2010-01-07 11:54:26 -0500
commitc14fa516ae5525f93af562910d22f0a836ebdde3 (patch)
treedd984425094a9a2d5fef0dd958d52153f796f1ec
parentc68fbc2071f67876edbb3fca202362aecb82ca9c (diff)
downloadjquery-c14fa516ae5525f93af562910d22f0a836ebdde3.tar.gz
jquery-c14fa516ae5525f93af562910d22f0a836ebdde3.zip
Back out the try/catch logic from around JSON.parse. We should always try to use it, otherwise security will suffer.
-rw-r--r--src/ajax.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ajax.js b/src/ajax.js
index 35d83e4fa..9b8e800e8 100644
--- a/src/ajax.js
+++ b/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))();
}
}