diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2017-09-08 12:48:50 +0200 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2017-09-08 12:48:50 +0200 |
commit | 337a90329c054c03de9249458f87138f8d789572 (patch) | |
tree | 262f1a9e1d0929bd3808e927e86da0e7853103bc /ports/geckolib/error_reporter.rs | |
parent | 54cd23adb8e9c10f5b5ef2c6f19b5d1e0351a1c5 (diff) | |
download | servo-337a90329c054c03de9249458f87138f8d789572.tar.gz servo-337a90329c054c03de9249458f87138f8d789572.zip |
stylo: Error reporting for unknown media features
Diffstat (limited to 'ports/geckolib/error_reporter.rs')
-rw-r--r-- | ports/geckolib/error_reporter.rs | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/ports/geckolib/error_reporter.rs b/ports/geckolib/error_reporter.rs index 4b0a1ed088a..b8aa1f091b6 100644 --- a/ports/geckolib/error_reporter.rs +++ b/ports/geckolib/error_reporter.rs @@ -141,6 +141,14 @@ fn extract_error_params<'a>(err: ParseError<'a>) -> Option<ErrorParams<'a>> { PropertyDeclarationParseError::InvalidValue(property, Some(e))))) => (Some(ErrorString::Snippet(property.into())), Some(extract_value_error_param(e))), + CssParseError::Custom(SelectorParseError::Custom( + StyleParseError::MediaQueryExpectedFeatureName(ident))) => + (Some(ErrorString::Ident(ident)), None), + + CssParseError::Custom(SelectorParseError::Custom( + StyleParseError::ExpectedIdentifier(token))) => + (Some(ErrorString::UnexpectedToken(token)), None), + CssParseError::Custom(SelectorParseError::UnexpectedTokenInAttributeSelector(t)) | CssParseError::Custom(SelectorParseError::BadValueInAttr(t)) | CssParseError::Custom(SelectorParseError::ExpectedBarInAttr(t)) | @@ -189,7 +197,8 @@ impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> { ContextualParseError::InvalidRule(s, err) | ContextualParseError::UnsupportedRule(s, err) | ContextualParseError::UnsupportedViewportDescriptorDeclaration(s, err) | - ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(s, err) => + ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(s, err) | + ContextualParseError::InvalidMediaRule(s, err) => (s.into(), err), ContextualParseError::InvalidCounterStyleWithoutSymbols(s) | ContextualParseError::InvalidCounterStyleNotEnoughSymbols(s) => @@ -281,6 +290,30 @@ impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> { }; return (prefix, b"PEBadSelectorRSIgnored\0", Action::Nothing); } + ContextualParseError::InvalidMediaRule(_, ref err) => { + let err: &[u8] = match *err { + CssParseError::Custom(SelectorParseError::Custom( + StyleParseError::ExpectedIdentifier(..))) => { + b"PEGatherMediaNotIdent\0" + }, + CssParseError::Custom(SelectorParseError::Custom( + StyleParseError::MediaQueryExpectedFeatureName(..))) => { + b"PEMQExpectedFeatureName\0" + }, + CssParseError::Custom(SelectorParseError::Custom( + StyleParseError::MediaQueryExpectedFeatureValue)) => { + b"PEMQExpectedFeatureValue\0" + }, + CssParseError::Custom(SelectorParseError::Custom( + StyleParseError::RangedExpressionWithNoValue)) => { + b"PEMQNoMinMaxWithoutValue\0" + }, + _ => { + b"PEDeclDropped\0" + }, + }; + (err, Action::Nothing) + } ContextualParseError::UnsupportedRule(..) => (b"PEDeclDropped\0", Action::Nothing), ContextualParseError::UnsupportedViewportDescriptorDeclaration(..) | |