Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: src/json.js

Issue 1220603002: Fix the reviver function in JSON.parse Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | test/mjsunit/regress/regress-3136.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json.js
diff --git a/src/json.js b/src/json.js
index e405f87bab6b39a6905304adbc66ebd8f421d00d..1901b07a3985e4a75e123336a8c36aeaee11f5f3 100644
--- a/src/json.js
+++ b/src/json.js
@@ -35,7 +35,11 @@ function Revive(holder, name, reviver) {
var length = val.length;
for (var i = 0; i < length; i++) {
var newElement = Revive(val, %_NumberToString(i), reviver);
- val[i] = newElement;
+ if (IS_UNDEFINED(newElement)) {
+ delete val[i];
+ } else {
+ val[i] = newElement;
+ }
}
} else {
for (var p in val) {
« no previous file with comments | « AUTHORS ('k') | test/mjsunit/regress/regress-3136.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698