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

Side by Side Diff: test/webkit/fast/js/JSON-parse-reviver.js

Issue 1506933003: JSON.parse: properly deal with reviver result (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | test/webkit/fast/js/JSON-parse-reviver-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 1. Redistributions of source code must retain the above copyright 7 // 1. Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // 2. Redistributions in binary form must reproduce the above copyright 9 // 2. Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the 10 // notice, this list of conditions and the following disclaimer in the
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 break; 68 break;
69 69
70 case 3: 70 case 3:
71 debug(""); 71 debug("");
72 debug("Ensure that we visited a value that we have deleted, and that deletion is reflected while filtering."); 72 debug("Ensure that we visited a value that we have deleted, and that deletion is reflected while filtering.");
73 shouldBeFalse("currentHolder.hasOwnProperty(3)"); 73 shouldBeFalse("currentHolder.hasOwnProperty(3)");
74 value = v; 74 value = v;
75 debug(""); 75 debug("");
76 debug("Ensure that when visiting a deleted property value is undefin ed"); 76 debug("Ensure that when visiting a deleted property value is undefin ed");
77 shouldBeUndefined("value"); 77 shouldBeUndefined("value");
78 this.length = 3;
78 v = "undelete the property"; 79 v = "undelete the property";
79 expectedLength = this.length = 3; 80 expectedLength = 4;
80 break; 81 break;
81 82
82 case 4: 83 case 4:
83 if (this.length != 3) { 84 if (this.length != 4) {
84 testFailed("Did not call reviver for deleted property"); 85 testFailed("Did not call reviver for deleted property");
85 expectedLength = this.length = 3; 86 expectedLength = this.length = 3;
86 break; 87 break;
87 } 88 }
88 89
89 case 5: 90 case 5:
90 testPassed("Ensured that property was visited despite Array length b eing reduced."); 91 testPassed("Ensured that property was visited despite Array length b eing reduced.");
91 value = v; 92 value = v;
92 shouldBeUndefined("value"); 93 shouldBeUndefined("value");
93 this[10] = "fail"; 94 this[10] = "fail";
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 var createdBadness = false; 195 var createdBadness = false;
195 function reviveIntroducesNewArrayLikeObject(i, v) { 196 function reviveIntroducesNewArrayLikeObject(i, v) {
196 if (i == 0 && !createdBadness) { 197 if (i == 0 && !createdBadness) {
197 this[1] = /(a)+/.exec("a"); 198 this[1] = /(a)+/.exec("a");
198 createdBadness = true; 199 createdBadness = true;
199 } 200 }
200 return v; 201 return v;
201 } 202 }
202 203
203 shouldBe('JSON.stringify(JSON.parse("[0,1]", reviveIntroducesNewArrayLikeObject) )', '\'[0,["a","a"]]\''); 204 shouldBe('JSON.stringify(JSON.parse("[0,1]", reviveIntroducesNewArrayLikeObject) )', '\'[0,["a","a"]]\'');
OLDNEW
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | test/webkit/fast/js/JSON-parse-reviver-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698