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

Issue 1760643004: Add mojo struct traits for GURL so that it can be sent over mojoms. (Closed)

Created:
4 years, 9 months ago by jam
Modified:
4 years, 9 months ago
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, chromium-reviews, darin (slow to review), qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add mojo struct traits for GURL so that it can be sent over mojoms. The motivation for adding a structtraits for GURL, as opposed to using paramtraits, is that most probably we'll be passing urls to languages other than C++. BUG=586194 Committed: https://crrev.com/baaeb815d807659fc7fe9b8cba2cc3b4d20018bf Cr-Commit-Position: refs/heads/master@{#379128}

Patch Set 1 #

Patch Set 2 : gyp #

Patch Set 3 : fix gn check #

Total comments: 2

Patch Set 4 : move to mojom namespace and add security owners #

Total comments: 6

Patch Set 5 : review comments #

Total comments: 6

Patch Set 6 : review comments #

Patch Set 7 : review comments #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+310 lines, -36 lines) Patch
M url/BUILD.gn View 1 2 3 4 2 chunks +6 lines, -1 line 0 comments Download
M url/DEPS View 1 chunk +4 lines, -0 lines 0 comments Download
A url/mojo/BUILD.gn View 1 chunk +36 lines, -0 lines 0 comments Download
A url/mojo/DEPS View 1 chunk +3 lines, -0 lines 0 comments Download
A url/mojo/OWNERS View 1 2 3 4 5 1 chunk +27 lines, -0 lines 0 comments Download
A + url/mojo/gurl.typemap View 1 2 3 4 1 chunk +14 lines, -9 lines 0 comments Download
A + url/mojo/url.mojom View 1 2 3 1 chunk +9 lines, -8 lines 0 comments Download
A url/mojo/url_gurl_struct_traits.h View 1 2 3 4 1 chunk +39 lines, -0 lines 0 comments Download
A url/mojo/url_gurl_struct_traits_unittest.cc View 1 2 3 4 5 6 1 chunk +73 lines, -0 lines 3 comments Download
A + url/mojo/url_test.mojom View 1 2 3 1 chunk +12 lines, -10 lines 0 comments Download
A + url/run_all_unittests.cc View 2 chunks +15 lines, -7 lines 0 comments Download
M url/url.gyp View 1 2 3 4 2 chunks +72 lines, -1 line 0 comments Download

Messages

Total messages: 24 (8 generated)
jam
4 years, 9 months ago (2016-03-03 05:01:56 UTC) #3
Ken Rockot(use gerrit already)
https://codereview.chromium.org/1760643004/diff/40001/url/mojo/url.mojom File url/mojo/url.mojom (right): https://codereview.chromium.org/1760643004/diff/40001/url/mojo/url.mojom#newcode5 url/mojo/url.mojom:5: module url; I think this is fine as is, ...
4 years, 9 months ago (2016-03-03 05:23:28 UTC) #4
Ken Rockot(use gerrit already)
lgtm
4 years, 9 months ago (2016-03-03 05:23:33 UTC) #5
jam
+dcheng as security reviewer Daniel: this adds a mojo URL type that is really a ...
4 years, 9 months ago (2016-03-03 16:09:04 UTC) #7
dcheng
https://codereview.chromium.org/1760643004/diff/60001/url/mojo/url_gurl.h File url/mojo/url_gurl.h (right): https://codereview.chromium.org/1760643004/diff/60001/url/mojo/url_gurl.h#newcode1 url/mojo/url_gurl.h:1: // Copyright 2016 The Chromium Authors. All rights reserved. ...
4 years, 9 months ago (2016-03-03 16:23:53 UTC) #8
dcheng
(Also, out of the scope of this immediate CL, but what's the relationship between type ...
4 years, 9 months ago (2016-03-03 16:24:32 UTC) #9
yzshen1
On 2016/03/03 16:24:32, dcheng wrote: > (Also, out of the scope of this immediate CL, ...
4 years, 9 months ago (2016-03-03 16:32:27 UTC) #10
Ken Rockot(use gerrit already)
There should probably never be overlap. In general, TypeConverters are inefficient since they take real ...
4 years, 9 months ago (2016-03-03 16:33:53 UTC) #11
jam
Ken: I think struct traits is something we need proper documentation for, especially since we'll ...
4 years, 9 months ago (2016-03-03 21:25:12 UTC) #12
dcheng
lgtm with comments addressed https://codereview.chromium.org/1760643004/diff/80001/url/mojo/OWNERS File url/mojo/OWNERS (right): https://codereview.chromium.org/1760643004/diff/80001/url/mojo/OWNERS#newcode3 url/mojo/OWNERS:3: per-file url_gurl_struct_traits_unittest.h=set noparent Change this ...
4 years, 9 months ago (2016-03-03 21:37:37 UTC) #13
yzshen1
https://codereview.chromium.org/1760643004/diff/120001/url/mojo/url_gurl_struct_traits_unittest.cc File url/mojo/url_gurl_struct_traits_unittest.cc (right): https://codereview.chromium.org/1760643004/diff/120001/url/mojo/url_gurl_struct_traits_unittest.cc#newcode68 url/mojo/url_gurl_struct_traits_unittest.cc:68: EXPECT_TRUE(proxy->Bounce(input, &output)); Hmm.. this test case should result in ...
4 years, 9 months ago (2016-03-03 21:47:56 UTC) #15
jam
https://codereview.chromium.org/1760643004/diff/80001/url/mojo/OWNERS File url/mojo/OWNERS (right): https://codereview.chromium.org/1760643004/diff/80001/url/mojo/OWNERS#newcode3 url/mojo/OWNERS:3: per-file url_gurl_struct_traits_unittest.h=set noparent On 2016/03/03 21:37:36, dcheng wrote: > ...
4 years, 9 months ago (2016-03-03 21:49:47 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1760643004/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1760643004/120001
4 years, 9 months ago (2016-03-03 21:49:52 UTC) #19
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 9 months ago (2016-03-03 23:12:06 UTC) #21
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/baaeb815d807659fc7fe9b8cba2cc3b4d20018bf Cr-Commit-Position: refs/heads/master@{#379128}
4 years, 9 months ago (2016-03-03 23:13:32 UTC) #23
yzshen1
4 years, 9 months ago (2016-03-09 00:01:52 UTC) #24
Message was sent while issue was closed.
https://codereview.chromium.org/1760643004/diff/120001/url/mojo/url_gurl_stru...
File url/mojo/url_gurl_struct_traits_unittest.cc (right):

https://codereview.chromium.org/1760643004/diff/120001/url/mojo/url_gurl_stru...
url/mojo/url_gurl_struct_traits_unittest.cc:68: EXPECT_TRUE(proxy->Bounce(input,
&output));
On 2016/03/03 21:49:47, jam wrote:
> On 2016/03/03 21:47:56, yzshen1 wrote:
> > Hmm.. this test case should result in message pipe disconnection because of
> the
> > illegal input, right?
> > In that case, the returning value should be false, instead of returning true
> and
> > receive a connection error later.
> > 
> > I will fix the sync call behavior. (No need to block this CL on that, I will
> > update this test after the fix.)
> > Sorry. :)
> 
> thanks for noticing that, yes that'd be great.

I have looked into this issue and found that the sync call returns success
because the invalid input doesn't reach the the message pipe. Before sending,
the bindings call StructTraits::url() to serialize the input. This method
returns an empty string for any invalid input. Therefore, the data passed over
the message pipe is actually valid. (So the sync call logic is working as
expected in this case.)

It depends on which behavior we think that makes more sense. The current
StructTraits will automatically serialize invalid input as empty string. If we
want to disconnect the message pipe on invalid input instead, we need to remove
the validation code from StructTraits::url().

Powered by Google App Engine
This is Rietveld 408576698