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

Issue 1650473002: Setting selectorText of PageRule accepts invalid selectors (Closed)

Created:
4 years, 10 months ago by ramya.v
Modified:
4 years, 10 months ago
Reviewers:
Timothy Loh, rune, Rob Buis
CC:
chromium-reviews, blink-reviews-css, dglazkov+blink, apavlov+blink_chromium.org, darktears, blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Setting selectorText of PageRule accepts invalid selectors Allow to set selectorText for PageRule if the selectors are page rule selectors only. BUG=580956 Committed: https://crrev.com/d2de318527994d3951ddb09a0bad157c6d85f29d Cr-Commit-Position: refs/heads/master@{#372675}

Patch Set 1 #

Patch Set 2 : Rebasing the patch #

Patch Set 3 : Added testcase #

Patch Set 4 : Updated as per review comments #

Total comments: 14
Unified diffs Side-by-side diffs Delta from patch set Stats (+83 lines, -37 lines) Patch
M third_party/WebKit/Source/core/css/CSSPageRule.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/CSSPageRuleTest.cpp View 1 2 3 1 chunk +25 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParser.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParser.cpp View 1 2 3 1 chunk +10 lines, -0 lines 4 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParserImpl.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp View 1 2 3 3 chunks +45 lines, -36 lines 10 comments Download

Messages

Total messages: 18 (4 generated)
ramya.v
PTAL! Thanks
4 years, 10 months ago (2016-01-29 09:27:13 UTC) #2
rune
This doesn't look right. You check that page pseudos are the only allowed simple selectors ...
4 years, 10 months ago (2016-01-29 12:08:36 UTC) #4
rwlbuis
I was about to upload roughly the same patch! :) Apart from the PseudoUnknown check, ...
4 years, 10 months ago (2016-01-29 15:11:55 UTC) #5
ramya.v
On 2016/01/29 15:11:55, rwlbuis wrote: > I was about to upload roughly the same patch! ...
4 years, 10 months ago (2016-02-01 13:09:11 UTC) #6
rune
lgtm https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp File third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp (right): https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp#newcode197 third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp:197: selector = CSSParserSelector::create(QualifiedName(nullAtom, typeSelector, styleSheet->defaultNamespace())); Namespaces for page ...
4 years, 10 months ago (2016-02-01 14:09:34 UTC) #7
ramya.v
https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp File third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp (right): https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp#newcode197 third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp:197: selector = CSSParserSelector::create(QualifiedName(nullAtom, typeSelector, styleSheet->defaultNamespace())); On 2016/02/01 14:09:34, rune ...
4 years, 10 months ago (2016-02-01 15:50:05 UTC) #8
ramya.v
4 years, 10 months ago (2016-02-01 15:50:06 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1650473002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1650473002/60001
4 years, 10 months ago (2016-02-01 15:51:04 UTC) #11
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 10 months ago (2016-02-01 16:55:33 UTC) #12
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/d2de318527994d3951ddb09a0bad157c6d85f29d Cr-Commit-Position: refs/heads/master@{#372675}
4 years, 10 months ago (2016-02-01 16:56:53 UTC) #14
Timothy Loh
https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Source/core/css/parser/CSSParser.cpp File third_party/WebKit/Source/core/css/parser/CSSParser.cpp (right): https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Source/core/css/parser/CSSParser.cpp#newcode45 third_party/WebKit/Source/core/css/parser/CSSParser.cpp:45: while (!range.atEnd() && range.peek().type() != LeftBraceToken && range.peek().type() != ...
4 years, 10 months ago (2016-02-01 21:55:16 UTC) #15
ramya.v
https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Source/core/css/parser/CSSParser.cpp File third_party/WebKit/Source/core/css/parser/CSSParser.cpp (right): https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Source/core/css/parser/CSSParser.cpp#newcode45 third_party/WebKit/Source/core/css/parser/CSSParser.cpp:45: while (!range.atEnd() && range.peek().type() != LeftBraceToken && range.peek().type() != ...
4 years, 10 months ago (2016-02-02 05:43:24 UTC) #16
Timothy Loh
https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Source/core/css/parser/CSSParser.cpp File third_party/WebKit/Source/core/css/parser/CSSParser.cpp (right): https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Source/core/css/parser/CSSParser.cpp#newcode45 third_party/WebKit/Source/core/css/parser/CSSParser.cpp:45: while (!range.atEnd() && range.peek().type() != LeftBraceToken && range.peek().type() != ...
4 years, 10 months ago (2016-02-02 05:49:12 UTC) #17
ramya.v
4 years, 10 months ago (2016-02-02 06:40:17 UTC) #18
Message was sent while issue was closed.
https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Sour...
File third_party/WebKit/Source/core/css/parser/CSSParser.cpp (right):

https://codereview.chromium.org/1650473002/diff/60001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/css/parser/CSSParser.cpp:45: while
(!range.atEnd() && range.peek().type() != LeftBraceToken && range.peek().type()
!= SemicolonToken)
On 2016/02/02 05:49:12, Timothy Loh wrote:
> On 2016/02/02 05:43:24, ramya.v wrote:
> > On 2016/02/01 21:55:15, Timothy Loh wrote:
> > > Seems wrong, if you specify ":left { bla" as a page selector it should be
> > > invalid (I assume regular selectors don't allow this sort of stuff
either).
> > 
> > In the existing implementation ":left { bla" is parsed as ":left {}" (empty
> > declaration block instead of completely invalidating the selector). 
> 
> Yes, but this function only concerns itself with parsing an @page selector,
not
> an @page rule.
> 
> For a style rule we don't allow this sort of thing:
> 
> <style> div { } </style>
> <script>
> var rule = document.styleSheets[0].cssRules[0];
> console.log(rule.selectorText) // "div"
> rule.selectorText = "span { bla"
> console.log(rule.selectorText) // still "div"
> </script>



Got your point. Thanks :) 
Done in https://codereview.chromium.org/1661453002/

Powered by Google App Engine
This is Rietveld 408576698