From 8a0a6903847d8b375f816ef975d00c3b03ad7dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 28 Aug 2017 21:03:34 +0200 Subject: [PATCH] style: Avoid dropping a parse error on the floor when checking whether a prop is enabled. --- .../style/properties/properties.mako.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 391778b8b68..128d927c258 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1073,7 +1073,7 @@ impl PropertyId { }, None => return Err(()), }; - id.check_allowed_in(alias, context).map_err(|_| ())?; + id.check_allowed_in(alias, context)?; Ok(id) } @@ -1156,8 +1156,11 @@ impl PropertyId { } } - fn check_allowed_in(&self, alias: Option, context: &PropertyParserContext) - -> Result<(), PropertyDeclarationParseError<'static>> { + fn check_allowed_in( + &self, + alias: Option, + context: &PropertyParserContext, + ) -> Result<(), ()> { let id: NonCustomPropertyId; if let Some(alias_id) = alias { id = alias_id.into(); @@ -1177,10 +1180,10 @@ impl PropertyId { ${id_set("DISALLOWED_IN_PAGE_RULE", lambda p: not p.allowed_in_page_rule)} match context.rule_type { CssRuleType::Keyframe if DISALLOWED_IN_KEYFRAME_BLOCK.contains(id) => { - return Err(PropertyDeclarationParseError::AnimationPropertyInKeyframeBlock) + return Err(()); } CssRuleType::Page if DISALLOWED_IN_PAGE_RULE.contains(id) => { - return Err(PropertyDeclarationParseError::NotAllowedInPageRule) + return Err(()) } _ => {} } @@ -1245,15 +1248,15 @@ impl PropertyId { if context.stylesheet_origin != Origin::UserAgent { if EXPERIMENTAL.contains(id) { if !passes_pref_check() { - return Err(PropertyDeclarationParseError::ExperimentalProperty); + return Err(()) } } else { - return Err(PropertyDeclarationParseError::UnknownProperty(self.name().into())); + return Err(()) } } } else { if EXPERIMENTAL.contains(id) && !passes_pref_check() { - return Err(PropertyDeclarationParseError::ExperimentalProperty); + return Err(()); } }