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

Issue 130563010: Invalid JSON output when BinaryValue suppressed. (Closed)

Created:
6 years, 10 months ago by Tom Sepez
Modified:
6 years, 10 months ago
Reviewers:
gab, Nico
CC:
chromium-reviews, erikwright+watch_chromium.org
Visibility:
Public.

Description

Invalid JSON output when BinaryValue type present as part of input object. JSON doesn't have a syntax to support the base::BinaryValue type, so when these are present under a base::DictionarValue or base::ListValue, they must be suppressed. However, in doing so, the current code doesn't properly suppress the commas between members as part of the overall suppression. Furthermore, if suppression was not enabled by the caller, we need to report failure if a BinaryValue is encountered. BUG=340441 BUG=340733 R=thakis@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=249830

Patch Set 1 #

Patch Set 2 : Return an error when you try to write a binaryvalue. #

Patch Set 3 : Better comments. #

Patch Set 4 : Produce same strings as before when error is returned for those who don't check em. #

Total comments: 2

Patch Set 5 : Rebase. #

Total comments: 9

Patch Set 6 : Address comments. #

Patch Set 7 : #ifdef out BinaryValue tests in debug mode to avoid crashes. #

Total comments: 2

Patch Set 8 : Log at ERROR level, not FATAL level. #

Total comments: 1

Patch Set 9 : Better naming. #

Patch Set 10 : NOTREACHED() & return false at end of function. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+144 lines, -94 lines) Patch
M base/json/json_string_value_serializer.cc View 1 1 chunk +1 line, -2 lines 0 comments Download
M base/json/json_writer.h View 1 2 3 4 5 2 chunks +11 lines, -9 lines 0 comments Download
M base/json/json_writer.cc View 1 2 3 4 5 6 7 8 9 10 chunks +42 lines, -36 lines 0 comments Download
M base/json/json_writer_unittest.cc View 1 6 7 3 chunks +90 lines, -47 lines 0 comments Download

Messages

Total messages: 27 (0 generated)
Tom Sepez
Nico, please review or suggest an appropriate viewer. The modified test fails without the patch, ...
6 years, 10 months ago (2014-02-03 23:11:39 UTC) #1
Tom Sepez
On 2014/02/03 23:11:39, Tom Sepez wrote: > Nico, please review or suggest an appropriate viewer. ...
6 years, 10 months ago (2014-02-04 20:01:35 UTC) #2
gab
https://codereview.chromium.org/130563010/diff/150001/base/json/json_writer.cc File base/json/json_writer.cc (right): https://codereview.chromium.org/130563010/diff/150001/base/json/json_writer.cc#newcode53 base/json/json_writer.cc:53: bool JSONWriter::BuildJSONString(const Value* const node, size_t depth) { Why ...
6 years, 10 months ago (2014-02-04 20:27:35 UTC) #3
Tom Sepez
On 2014/02/04 20:27:35, gab wrote: > https://codereview.chromium.org/130563010/diff/150001/base/json/json_writer.cc > File base/json/json_writer.cc (right): > > https://codereview.chromium.org/130563010/diff/150001/base/json/json_writer.cc#newcode53 > ...
6 years, 10 months ago (2014-02-04 20:31:44 UTC) #4
gab
On 2014/02/04 20:31:44, Tom Sepez wrote: > On 2014/02/04 20:27:35, gab wrote: > > https://codereview.chromium.org/130563010/diff/150001/base/json/json_writer.cc ...
6 years, 10 months ago (2014-02-04 20:34:50 UTC) #5
Tom Sepez
Ok, please review the updated patch set. Thanks!
6 years, 10 months ago (2014-02-06 19:08:09 UTC) #6
gab
lgtm w/ comments Cheers! Gab https://codereview.chromium.org/130563010/diff/210001/base/json/json_writer.cc File base/json/json_writer.cc (right): https://codereview.chromium.org/130563010/diff/210001/base/json/json_writer.cc#newcode121 base/json/json_writer.cc:121: const ListValue* list; = ...
6 years, 10 months ago (2014-02-07 02:24:26 UTC) #7
Tom Sepez
https://codereview.chromium.org/130563010/diff/210001/base/json/json_writer.cc File base/json/json_writer.cc (right): https://codereview.chromium.org/130563010/diff/210001/base/json/json_writer.cc#newcode121 base/json/json_writer.cc:121: const ListValue* list; On 2014/02/07 02:24:27, gab wrote: > ...
6 years, 10 months ago (2014-02-07 02:30:50 UTC) #8
gab
https://codereview.chromium.org/130563010/diff/210001/base/json/json_writer.cc File base/json/json_writer.cc (right): https://codereview.chromium.org/130563010/diff/210001/base/json/json_writer.cc#newcode195 base/json/json_writer.cc:195: // Successful only if we're allowed to omit it. ...
6 years, 10 months ago (2014-02-07 02:37:25 UTC) #9
Tom Sepez
don't see why a crash here in Debug builds is a bad thing. It helps ...
6 years, 10 months ago (2014-02-07 02:39:32 UTC) #10
Tom Sepez
> Fair enough. I'll put the DLOG_IF() in. Done. See also the #ifdef in the ...
6 years, 10 months ago (2014-02-07 02:56:38 UTC) #11
gab
I changed my mind, you enlightened me with the ugly ifdef'ed tests, sorry about that. ...
6 years, 10 months ago (2014-02-07 03:12:11 UTC) #12
Tom Sepez
https://codereview.chromium.org/130563010/diff/360001/base/json/json_writer_unittest.cc File base/json/json_writer_unittest.cc (right): https://codereview.chromium.org/130563010/diff/360001/base/json/json_writer_unittest.cc#newcode158 base/json/json_writer_unittest.cc:158: #ifdef NDEBUG On 2014/02/07 03:12:12, gab wrote: > This ...
6 years, 10 months ago (2014-02-07 17:40:03 UTC) #13
Tom Sepez
@gab - thanks for all your help. Would you like to take a final look ...
6 years, 10 months ago (2014-02-07 17:40:54 UTC) #14
gab
lgtm++, thanks, you'll still need Nico to stamp this Cheers, Gab
6 years, 10 months ago (2014-02-07 17:55:14 UTC) #15
Nico
lgtm Please make the CL description less cryptic, I didn't understand what it was saying ...
6 years, 10 months ago (2014-02-07 18:17:05 UTC) #16
Tom Sepez
On 2014/02/07 18:17:05, Nico wrote: > lgtm > > Please make the CL description less ...
6 years, 10 months ago (2014-02-07 18:30:10 UTC) #17
Nico
On Fri, Feb 7, 2014 at 10:30 AM, <tsepez@chromium.org> wrote: > On 2014/02/07 18:17:05, Nico ...
6 years, 10 months ago (2014-02-07 18:42:25 UTC) #18
Tom Sepez
On 2014/02/07 18:30:10, Tom Sepez wrote: > On 2014/02/07 18:17:05, Nico wrote: > > lgtm ...
6 years, 10 months ago (2014-02-07 18:43:34 UTC) #19
Tom Sepez
The CQ bit was checked by tsepez@chromium.org
6 years, 10 months ago (2014-02-07 18:44:11 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tsepez@chromium.org/130563010/490001
6 years, 10 months ago (2014-02-07 18:46:13 UTC) #21
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-07 19:06:48 UTC) #22
commit-bot: I haz the power
Retried try job too often on linux_rel for step(s) cacheinvalidation_unittests, cc_unittests, check_deps, check_deps2git, chromedriver_unittests, components_unittests, ...
6 years, 10 months ago (2014-02-07 19:06:49 UTC) #23
Tom Sepez
The CQ bit was checked by tsepez@chromium.org
6 years, 10 months ago (2014-02-07 19:34:49 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tsepez@chromium.org/130563010/770001
6 years, 10 months ago (2014-02-07 19:35:07 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tsepez@chromium.org/130563010/770001
6 years, 10 months ago (2014-02-07 22:16:52 UTC) #26
commit-bot: I haz the power
6 years, 10 months ago (2014-02-07 22:47:41 UTC) #27
Message was sent while issue was closed.
Change committed as 249830

Powered by Google App Engine
This is Rietveld 408576698