From 3884328ce329118ded269fc906604498252a75c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 5 Jun 2020 18:13:14 +0000 Subject: [PATCH] style: Clear last_parsed_property_id right after successfully parsing 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 --- components/style/properties/declaration_block.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index 5dc5d207f36b..75d05836972c 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -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))); }, }; @@ -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();