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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
ports/geckolib/glue.rs
Outdated
@@ -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() { |
There was a problem hiding this comment.
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));
?
2fb0c4c
to
3bd7887
Compare
@bors-servo r=upsuper |
📌 Commit 3bd7887 has been approved by |
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 -->
☀️ 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 |
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 ofPropertyDeclaration::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