Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(293)

Issue 224092: Issue 1190: JSON.parse failing on Chrome (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 3 months ago by MikeSamuel
Modified:
16 years, 3 months ago
Reviewers:
MarkM
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Chrome provides native JSON support. This interacts badly with revivers and replacers. I think the solution is not to use revivers, but to instead sanitize the input and output string. The problem that we're running into is that methods which memoize state on checking canSetPub cause infinite recursion. This adds a prepass that filters out bad keys, and fixes revivers and replacers. Submitted @4005

Patch Set 1 #

Total comments: 2

Patch Set 2 : Issue 1190: JSON.parse failing on Chrome #

Patch Set 3 : Issue 1190: JSON.parse failing on Chrome #

Patch Set 4 : Issue 1190: JSON.parse failing on Chrome #

Patch Set 5 : Issue 1190: JSON.parse failing on Chrome #

Total comments: 4

Patch Set 6 : Issue 1190: JSON.parse failing on Chrome #

Total comments: 8

Patch Set 7 : Issue 1190: JSON.parse failing on Chrome #

Total comments: 5

Patch Set 8 : Issue 1190: JSON.parse failing on Chrome #

Patch Set 9 : Issue 1190: JSON.parse failing on Chrome #

Unified diffs Side-by-side diffs Delta from patch set Stats (+347 lines, -117 lines) Patch
M src/com/google/caja/cajita.js View 1 2 3 4 5 1 chunk +18 lines, -18 lines 0 comments Download
M tests/com/google/caja/CajitaTest.java View 1 2 3 4 5 6 7 8 2 chunks +160 lines, -5 lines 0 comments Download
M third_party/js/json_sans_eval/json_sans_eval.js View 3 4 5 6 7 18 chunks +169 lines, -94 lines 0 comments Download

Messages

Total messages: 14
MikeSamuel
16 years, 3 months ago (2010-03-02 04:23:54 UTC) #1
MarkM
http://codereview.appspot.com/224092/diff/1/3 File src/com/google/caja/cajita.js (right): http://codereview.appspot.com/224092/diff/1/3#newcode875 src/com/google/caja/cajita.js:875: if (opt_memoize !== false) { fastpathSet(obj, name); } The ...
16 years, 3 months ago (2010-03-02 05:39:26 UTC) #2
MikeSamuel
http://codereview.appspot.com/224092/diff/1/3 File src/com/google/caja/cajita.js (right): http://codereview.appspot.com/224092/diff/1/3#newcode875 src/com/google/caja/cajita.js:875: if (opt_memoize !== false) { fastpathSet(obj, name); } On ...
16 years, 3 months ago (2010-03-02 05:50:10 UTC) #3
MikeSamuel
I reworked this to avoid the hackiness. There is now a syntax filter on the ...
16 years, 3 months ago (2010-03-04 19:59:33 UTC) #4
MikeSamuel
I tested this on V8 by running ../../v8/shell \ third_party/js/json_sans_eval/json_sans_eval.js \ src/com/google/caja/cajita.js /tmp/foo.js with the ...
16 years, 3 months ago (2010-03-04 20:11:24 UTC) #5
MarkM
What's JSON.checkSyntax? Where is it defined? http://codereview.appspot.com/224092/diff/2008/2010 File src/com/google/caja/cajita.js (right): http://codereview.appspot.com/224092/diff/2008/2010#newcode4129 src/com/google/caja/cajita.js:4129: JSON.checkSyntax(text, function (key) ...
16 years, 3 months ago (2010-03-04 23:56:49 UTC) #6
MikeSamuel
http://codereview.appspot.com/224092/diff/2008/2010 File src/com/google/caja/cajita.js (right): http://codereview.appspot.com/224092/diff/2008/2010#newcode4129 src/com/google/caja/cajita.js:4129: JSON.checkSyntax(text, function (key) { On 2010/03/04 23:56:49, MarkM wrote: ...
16 years, 3 months ago (2010-03-05 00:15:10 UTC) #7
MarkM
http://codereview.appspot.com/224092/diff/6001/7003 File third_party/js/json_sans_eval/json_sans_eval.js (right): http://codereview.appspot.com/224092/diff/6001/7003#newcode536 third_party/js/json_sans_eval/json_sans_eval.js:536: JSON.checkSyntax = function checkJson(text, keyFilter) { Sorry I missed ...
16 years, 3 months ago (2010-03-05 00:50:01 UTC) #8
MikeSamuel
http://codereview.appspot.com/224092/diff/6001/7003 File third_party/js/json_sans_eval/json_sans_eval.js (right): http://codereview.appspot.com/224092/diff/6001/7003#newcode536 third_party/js/json_sans_eval/json_sans_eval.js:536: JSON.checkSyntax = function checkJson(text, keyFilter) { On 2010/03/05 00:50:01, ...
16 years, 3 months ago (2010-03-05 01:30:20 UTC) #9
MarkM
LGTM http://codereview.appspot.com/224092/diff/13001/6004 File third_party/js/json_sans_eval/json_sans_eval.js (right): http://codereview.appspot.com/224092/diff/13001/6004#newcode539 third_party/js/json_sans_eval/json_sans_eval.js:539: checkArray(); I'm surprised to see this as the ...
16 years, 3 months ago (2010-03-05 05:18:35 UTC) #10
MarkM
Retracting the previous LGTM. Instead of erasing the associations for forbidden property names, shouldn't we ...
16 years, 3 months ago (2010-03-05 14:57:56 UTC) #11
MikeSamuel
On 2010/03/05 14:57:56, MarkM wrote: > Retracting the previous LGTM. Instead of erasing the associations ...
16 years, 3 months ago (2010-03-05 17:40:50 UTC) #12
MikeSamuel
On 2010/03/05 14:57:56, MarkM wrote: > Retracting the previous LGTM. Instead of erasing the associations ...
16 years, 3 months ago (2010-03-05 21:56:24 UTC) #13
MarkM
16 years, 3 months ago (2010-03-05 21:58:44 UTC) #14
LGTM
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b