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

Issue 9133002: Added support for file URI path wildcards in content settings (Closed)

Created:
8 years, 11 months ago by Francois
Modified:
8 years, 10 months ago
CC:
chromium-reviews, darin-cc_chromium.org, brettw-cc_chromium.org, Eric U.
Visibility:
Public.

Description

Added support for file URI path wildcards in content settings patterns. I.e. "file:///*" matches all file URIs. Full/explicit/absolute paths (e.g. "file:///foo/bar.html") are still supported. BUG=77149 TEST=ContentSettingsPattern* in unit_tests (added new ones).

Patch Set 1 #

Total comments: 24

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 10

Patch Set 4 : '' #

Total comments: 2

Patch Set 5 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+183 lines, -48 lines) Patch
M AUTHORS View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/content_settings_pattern.h View 1 2 3 4 3 chunks +8 lines, -0 lines 0 comments Download
M chrome/common/content_settings_pattern.cc View 1 2 3 4 7 chunks +36 lines, -23 lines 0 comments Download
M chrome/common/content_settings_pattern_parser.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/content_settings_pattern_parser.cc View 1 2 3 4 3 chunks +16 lines, -5 lines 0 comments Download
M chrome/common/content_settings_pattern_parser_unittest.cc View 1 2 3 4 4 chunks +83 lines, -9 lines 0 comments Download
M chrome/common/content_settings_pattern_unittest.cc View 1 2 3 4 3 chunks +36 lines, -11 lines 0 comments Download
M chrome/common/render_messages.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
Francois
Hi, render_messages.h had a bunch of cpplint warnings that I fixed; probably shouldn't have included ...
8 years, 11 months ago (2012-01-06 17:22:59 UTC) #1
Bernhard Bauer
Thanks for the patch! It looks pretty good, I just have some style comments below. ...
8 years, 11 months ago (2012-01-09 13:23:41 UTC) #2
Francois
Please see my changes and comments. I also signed the Individual Contributor License. Thanks a ...
8 years, 11 months ago (2012-01-09 14:50:49 UTC) #3
markusheintz_
Thanks a lot for contributing this CL :). That's great! I only have a few ...
8 years, 11 months ago (2012-01-09 15:00:59 UTC) #4
markusheintz_
Adding Eric U; FYI
8 years, 11 months ago (2012-01-09 15:24:36 UTC) #5
Francois
Thanks a lot Markus, please see my changes and comments. http://codereview.chromium.org/9133002/diff/1/chrome/common/content_settings_pattern.cc File chrome/common/content_settings_pattern.cc (right): http://codereview.chromium.org/9133002/diff/1/chrome/common/content_settings_pattern.cc#newcode430 ...
8 years, 11 months ago (2012-01-09 15:33:00 UTC) #6
Francois
Hi, would one of you please take another look at this? Thanks!
8 years, 11 months ago (2012-01-13 06:29:02 UTC) #7
markusheintz_
From my side this looks good. @bauerb: Do you have any more comments? Did you ...
8 years, 11 months ago (2012-01-13 16:15:38 UTC) #8
Bernhard Bauer
On 2012/01/13 16:15:38, markusheintz_ wrote: > From my side this looks good. > @bauerb: Do ...
8 years, 11 months ago (2012-01-13 16:21:29 UTC) #9
markusheintz_
LGTM! Let's commit :) On 2012/01/13 16:21:29, Bernhard Bauer wrote: > On 2012/01/13 16:15:38, markusheintz_ ...
8 years, 11 months ago (2012-01-13 16:43:46 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/francoisk777@gmail.com/9133002/18002
8 years, 11 months ago (2012-01-17 09:42:31 UTC) #11
commit-bot: I haz the power
Can't apply patch for file AUTHORS. While running patch -p0 --forward --force; patching file AUTHORS ...
8 years, 11 months ago (2012-01-17 09:42:33 UTC) #12
markusheintz_
Hey Francois I just noticed that we haven't submitted your CL yet. So I'm kind ...
8 years, 11 months ago (2012-01-17 09:52:57 UTC) #13
Francois
Hi Markus Please find my latest changes in Patch Set 4. I wasn't quite sure ...
8 years, 11 months ago (2012-01-18 15:34:45 UTC) #14
markusheintz_
Sorry. I should have been more precise. I actually wanted to use the URL "file:///" ...
8 years, 11 months ago (2012-01-18 19:45:24 UTC) #15
Francois
8 years, 11 months ago (2012-01-19 08:43:07 UTC) #16
Hi Markus

Please see my comments and my latest changes in Patch Set 5.

Thanks,
Francois

http://codereview.chromium.org/9133002/diff/18002/chrome/common/content_setti...
File chrome/common/content_settings_pattern.cc (right):

http://codereview.chromium.org/9133002/diff/18002/chrome/common/content_setti...
chrome/common/content_settings_pattern.cc:209: }
On 2012/01/18 15:34:45, Francois wrote:
> Please note that my new CL (Patch Set 4) removes the rejection of "/".

Added back in Patch Set 5.

http://codereview.chromium.org/9133002/diff/18002/chrome/common/content_setti...
chrome/common/content_settings_pattern.cc:319:
builder->WithScheme(url.scheme())->WithPath(url.path());
On 2012/01/18 19:45:24, markusheintz_ wrote:
> On 2012/01/18 15:34:45, Francois wrote:
> > On 2012/01/17 09:52:58, markusheintz_ wrote:
> > > Please replace 319 with:
> > > 
> > > if (url.path().empty()) {
> > >   builder->WithPath(url.path());
> > > } else {
> > >   builder->WithPathWildcard();
> > > }
> > 
> > Done, but I also set the scheme, which I hope is correct.
> 
> Yes this is absolutely correct. I actually meant it the way to implemented it
> :).

I also had to change it so that it sets the wildcard only if url.path() == "/"
(because GURL("file:///").path() == "/"), and the path, otherwise. It now reads:

    if (url.path() == "/") {
      builder->WithPathWildcard();
    } else {
      builder->WithPath(url.path());
    }

http://codereview.chromium.org/9133002/diff/18002/chrome/common/content_setti...
File chrome/common/content_settings_pattern_unittest.cc (right):

http://codereview.chromium.org/9133002/diff/18002/chrome/common/content_setti...
chrome/common/content_settings_pattern_unittest.cc:176:
EXPECT_FALSE(Pattern("file:///").IsValid());
On 2012/01/18 15:34:45, Francois wrote:
> Please note that my new CL (Patch Set 4) removes this assertion.

Added back in Patch Set 5.

http://codereview.chromium.org/9133002/diff/28001/chrome/common/content_setti...
File chrome/common/content_settings_pattern_unittest.cc (right):

http://codereview.chromium.org/9133002/diff/28001/chrome/common/content_setti...
chrome/common/content_settings_pattern_unittest.cc:93:
EXPECT_TRUE(pattern.IsValid());
On 2012/01/18 19:45:24, markusheintz_ wrote:
> I should have been more precise here. Sorry.
> 
> These lines should be added as well.
> 
> EXPECT_TRUE(pattern.Matches(GURL("file:///")));
> EXPECT_TRUE(pattern.Matches(GURL("file:///foo")));
> EXPECT_TRUE(pattern.Matches(GURL("file:///foo/bar.html")));

Done. Also added
  EXPECT_EQ("file:///*", pattern.ToString());

Powered by Google App Engine
This is Rietveld 408576698