Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop parsing @supports rules before Delimiter::Bang #17173

Merged
merged 2 commits into from Jun 6, 2017

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Jun 5, 2017

Fixes #15482

Shorthand parsing uses parse_entirely, so we have to ask it to stop before the !important.

An alternate fix is to not use parse_entirely there and ensuring that all callers of PropertyDeclaration::parse_into() check that the input is exhausted. Two of the three callers do that anyway because they check for !important.

We also weren't checking for the end of the parser for CSS.supports().


This change is Reviewable

@highfive
Copy link

highfive commented Jun 5, 2017

Heads up! This PR modifies the following files:

  • @bholley: components/style/stylesheets/supports_rule.rs
  • @emilio: components/style/stylesheets/supports_rule.rs

@highfive
Copy link

highfive commented Jun 5, 2017

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 5, 2017
@Manishearth
Copy link
Member Author

r? @upsuper or @emilio

@highfive highfive assigned upsuper and unassigned emilio Jun 5, 2017
@Manishearth Manishearth changed the title Stop parsing @supports rules before Delimeter::Bang Stop parsing @supports rules before Delimiter::Bang Jun 5, 2017
Copy link
Contributor

@upsuper upsuper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

@@ -2299,6 +2299,9 @@ pub extern "C" fn Servo_CSSSupports(cond: *const nsACString) -> bool {
let condition = unsafe { cond.as_ref().unwrap().as_str_unchecked() };
let mut input = Parser::new(&condition);
let cond = parse_condition_or_declaration(&mut input);
if !input.is_exhausted() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just input.parse_entirely(|i| parse_condition_or_declaration(i));?

@Manishearth
Copy link
Member Author

@bors-servo r=upsuper

@bors-servo
Copy link
Contributor

📌 Commit 3bd7887 has been approved by upsuper

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jun 6, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit 3bd7887 with merge eaa0122...

bors-servo pushed a commit that referenced this pull request Jun 6, 2017
Stop parsing @supports rules before Delimiter::Bang

Fixes #15482

Shorthand parsing uses `parse_entirely`, so we have to ask it to stop before the `!important`.

An alternate fix is to not use `parse_entirely` there and ensuring that all callers of `PropertyDeclaration::parse_into()` check that the input is exhausted. Two of the three callers do that anyway because they check for `!important`.

We also weren't checking for the end of the parser for `CSS.supports()`.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17173)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: upsuper
Pushing eaa0122 to master...

@bors-servo bors-servo merged commit 3bd7887 into servo:master Jun 6, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jun 6, 2017
@Manishearth Manishearth deleted the supports-fixes branch May 7, 2019 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Various issues around conditions for syntax accepted by @supports
5 participants