🌐 AI搜索 & 代理 主页
Skip to content

Commit c14fa51

Browse files
committed
Back out the try/catch logic from around JSON.parse. We should always try to use it, otherwise security will suffer.
1 parent c68fbc2 commit c14fa51

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ajax.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,10 @@ jQuery.extend({
578578
// Get the JavaScript object, if JSON is used.
579579
if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
580580
// Try to use the native JSON parser first
581-
try {
582-
data = JSON.parse( data );
581+
if ( window.JSON && window.JSON.parse ) {
582+
data = window.JSON.parse( data );
583583

584-
} catch(e) {
584+
} else {
585585
data = (new Function("return " + data))();
586586
}
587587
}

0 commit comments

Comments
 (0)