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

Unified Diff: test/mjsunit/regress/regress-3136.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 | « src/json.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-3136.js
diff --git a/test/mjsunit/context-variable-assignments.js b/test/mjsunit/regress/regress-3136.js
similarity index 88%
copy from test/mjsunit/context-variable-assignments.js
copy to test/mjsunit/regress/regress-3136.js
index 930b969609b5974f2c2ed46ab79610f575a171fd..41ed1c8056b24aad0675597e9b3d08fcfdf63e48 100644
--- a/test/mjsunit/context-variable-assignments.js
+++ b/test/mjsunit/regress/regress-3136.js
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2015 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -25,13 +25,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-function foo() {
- var a, b;
- var bar = function() {
- a = b = "hello world";
+function reviver(p, v) {
+ if (p == 0) {
+ this.length = 0;
}
- bar();
- return a;
+ return v;
}
-assertEquals("hello world", foo());
+var len = JSON.parse("[1,2,3]", reviver).length
+assertEquals(1, len);
« no previous file with comments | « src/json.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698