Skip to content

Commit

Permalink
style: Clear last_parsed_property_id right after successfully parsing…
Browse files Browse the repository at this point in the history
… the value.

Rather than waiting until parsing another id (successfully or
unsuccessfully).

If we error before we even get to PropertyId::parse, we'd incorrectly
associate the error with the wrong property, incorrectly omitting it
sometimes.

Differential Revision: https://phabricator.services.mozilla.com/D78260
  • Loading branch information
emilio committed Jun 18, 2020
1 parent 685e749 commit 3884328
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/style/properties/declaration_block.rs
Expand Up @@ -1347,7 +1347,6 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for PropertyDeclarationParser<'a, 'b> {
let id = match PropertyId::parse(&name, self.context) {
Ok(id) => id,
Err(..) => {
self.last_parsed_property_id = None;
return Err(input.new_custom_error(StyleParseErrorKind::UnknownProperty(name)));
},
};
Expand Down Expand Up @@ -1469,6 +1468,10 @@ pub fn parse_property_declaration_list(
match declaration {
Ok(importance) => {
block.extend(iter.parser.declarations.drain(), importance);
// We've successfully parsed a declaration, so forget about
// `last_parsed_property_id`. It'd be wrong to associate any
// following error with this property.
iter.parser.last_parsed_property_id = None;
},
Err((error, slice)) => {
iter.parser.declarations.clear();
Expand Down

0 comments on commit 3884328

Please sign in to comment.