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

Issue 10890002: Make V8ValueConverter.FromV8Value behave similarly to JSON.stringify (Closed)

Created:
8 years, 3 months ago by not at google - send to devlin
Modified:
8 years, 3 months ago
CC:
chromium-reviews, Aaron Boodman, mihaip-chromium-reviews_chromium.org, darin-cc_chromium.org, brettw-cc_chromium.org, benwells
Visibility:
Public.

Description

Make V8ValueConverter.FromV8Value be more consistent with JSON.stringify: don't serialize undefined as null, don't serialize functions as objects, omit values from objects when they don't serialize, and insert null into arrays when they don't serialize. It is now possible for FromV8Value to return NULL; previously it would return Value::CreateNullValue on failure. This is needed for the Storage API, where we promise that the values that are passed in are serialized as JSON, yet the value conversion doesn't work in a way that allows it. However, the null-stripping behavior needs to be configurable so that existing extension APIs (which only expect null/undefined to appear for optional values) still work. BUG=145081 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=157074

Patch Set 1 #

Total comments: 1

Patch Set 2 : make it a property of sendRequest #

Patch Set 3 : fix nulls #

Patch Set 4 : test compile error #

Patch Set 5 : ignore -> omit #

Total comments: 5

Patch Set 6 : make contextMenus API work again #

Patch Set 7 : cleanup from last patchset #

Patch Set 8 : use the actual objects, not empty objects #

Total comments: 3

Patch Set 9 : comment #

Patch Set 10 : more comments #

Patch Set 11 : no more function #

Unified diffs Side-by-side diffs Delta from patch set Stats (+274 lines, -147 lines) Patch
M chrome/renderer/extensions/event_bindings.cc View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/renderer/extensions/send_request_natives.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +7 lines, -5 lines 0 comments Download
M chrome/renderer/extensions/user_script_scheduler.cc View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -2 lines 0 comments Download
M chrome/renderer/resources/extensions/context_menus_custom_bindings.js View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -4 lines 0 comments Download
M chrome/renderer/resources/extensions/schema_generated_bindings.js View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -1 line 0 comments Download
M chrome/renderer/resources/extensions/send_request.js View 1 2 3 4 5 6 7 8 9 10 3 chunks +16 lines, -12 lines 0 comments Download
M chrome/renderer/resources/extensions/storage_custom_bindings.js View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M chrome/test/data/extensions/api_test/settings/simple_test/background.js View 1 17 chunks +67 lines, -35 lines 0 comments Download
M content/public/renderer/v8_value_converter.h View 1 2 3 4 5 6 7 8 1 chunk +33 lines, -16 lines 0 comments Download
M content/renderer/render_view_impl.cc View 1 2 3 4 5 6 7 8 2 chunks +4 lines, -3 lines 0 comments Download
M content/renderer/v8_value_converter_impl.h View 1 2 3 4 5 6 7 8 9 2 chunks +7 lines, -11 lines 0 comments Download
M content/renderer/v8_value_converter_impl.cc View 1 2 3 4 5 6 7 8 5 chunks +39 lines, -34 lines 0 comments Download
M content/renderer/v8_value_converter_impl_unittest.cc View 1 2 3 4 5 6 7 8 7 chunks +85 lines, -23 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
not at google - send to devlin
I'm not sure about the approach here. I kind of want this "null safe API" ...
8 years, 3 months ago (2012-08-28 05:59:38 UTC) #1
koz (OOO until 15th September)
On 2012/08/28 05:59:38, kalman wrote: > I'm not sure about the approach here. > > ...
8 years, 3 months ago (2012-08-28 06:15:02 UTC) #2
not at google - send to devlin
On 2012/08/28 06:15:02, koz wrote: > On 2012/08/28 05:59:38, kalman wrote: > > I'm not ...
8 years, 3 months ago (2012-08-28 06:49:56 UTC) #3
koz (OOO until 15th September)
On 2012/08/28 06:49:56, kalman wrote: > On 2012/08/28 06:15:02, koz wrote: > > On 2012/08/28 ...
8 years, 3 months ago (2012-08-28 06:58:23 UTC) #4
not at google - send to devlin
Ok, done. It ended up being a bit of a yak, since I realised that ...
8 years, 3 months ago (2012-09-11 11:47:34 UTC) #5
not at google - send to devlin
https://chromiumcodereview.appspot.com/10890002/diff/18002/content/public/renderer/v8_value_converter.h File content/public/renderer/v8_value_converter.h (right): https://chromiumcodereview.appspot.com/10890002/diff/18002/content/public/renderer/v8_value_converter.h#newcode36 content/public/renderer/v8_value_converter.h:36: TREAT_AS_ERROR, The existence of "treat as error" only makes ...
8 years, 3 months ago (2012-09-11 11:50:11 UTC) #6
Aaron Boodman
reviewers -= aa; if koz is happy i am happy
8 years, 3 months ago (2012-09-11 21:58:36 UTC) #7
Aaron Boodman
8 years, 3 months ago (2012-09-11 21:58:47 UTC) #8
koz (OOO until 15th September)
lgtm https://chromiumcodereview.appspot.com/10890002/diff/1/chrome/renderer/extensions/send_request_natives.cc File chrome/renderer/extensions/send_request_natives.cc (right): https://chromiumcodereview.appspot.com/10890002/diff/1/chrome/renderer/extensions/send_request_natives.cc#newcode25 chrome/renderer/extensions/send_request_natives.cc:25: // Some APIs can handle nulls in objects, ...
8 years, 3 months ago (2012-09-12 02:08:28 UTC) #9
not at google - send to devlin
Ok, so it turns out the contextMenus API relies on being able to convert functions ...
8 years, 3 months ago (2012-09-12 08:00:53 UTC) #10
not at google - send to devlin
Oh and in doing so I also cleaned up a bit more of V8ValueConverter (removed ...
8 years, 3 months ago (2012-09-12 08:01:51 UTC) #11
not at google - send to devlin
replacing avi@ with more targeted reviewers for content/renderer (jamesr) and content/public/renderer (joi).
8 years, 3 months ago (2012-09-14 00:59:41 UTC) #12
koz (OOO until 15th September)
lgtm https://chromiumcodereview.appspot.com/10890002/diff/15008/content/public/renderer/v8_value_converter.h File content/public/renderer/v8_value_converter.h (right): https://chromiumcodereview.appspot.com/10890002/diff/15008/content/public/renderer/v8_value_converter.h#newcode32 content/public/renderer/v8_value_converter.h:32: // seconds since Unix epoch. Good job on ...
8 years, 3 months ago (2012-09-14 02:05:44 UTC) #13
Jói
LGTM for content/public.
8 years, 3 months ago (2012-09-14 09:26:54 UTC) #14
jamesr
content/renderer lgtm
8 years, 3 months ago (2012-09-14 22:11:51 UTC) #15
not at google - send to devlin
https://chromiumcodereview.appspot.com/10890002/diff/15008/content/public/renderer/v8_value_converter.h File content/public/renderer/v8_value_converter.h (right): https://chromiumcodereview.appspot.com/10890002/diff/15008/content/public/renderer/v8_value_converter.h#newcode46 content/public/renderer/v8_value_converter.h:46: // additional properties has been set on them. On ...
8 years, 3 months ago (2012-09-15 06:24:24 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/10890002/10033
8 years, 3 months ago (2012-09-15 06:24:36 UTC) #17
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build. Your ...
8 years, 3 months ago (2012-09-15 07:13:54 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/10890002/10033
8 years, 3 months ago (2012-09-15 12:29:30 UTC) #19
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build. Your ...
8 years, 3 months ago (2012-09-15 13:12:02 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/10890002/12031
8 years, 3 months ago (2012-09-17 02:00:17 UTC) #21
commit-bot: I haz the power
8 years, 3 months ago (2012-09-17 04:05:26 UTC) #22
Change committed as 157074

Powered by Google App Engine
This is Rietveld 408576698