mirror of
https://github.com/servo/servo.git
synced 2025-08-16 10:55:34 +01:00
Auto merge of #18341 - ferjm:bug1384225.media.errors, r=jdm
stylo: Error reporting for unknown media features - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix [bug 1384225](https://bugzilla.mozilla.org/show_bug.cgi?id=1384225) <!-- 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/18341) <!-- Reviewable:end -->
This commit is contained in:
commit
fef2cfde8c
12 changed files with 206 additions and 109 deletions
|
@ -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(..) |
|
||||
|
|
|
@ -2491,7 +2491,7 @@ pub extern "C" fn Servo_MediaList_SetText(list: RawServoMediaListBorrowed, text:
|
|||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
write_locked_arc(list, |list: &mut MediaList| {
|
||||
*list = parse_media_query_list(&context, &mut parser);
|
||||
*list = parse_media_query_list(&context, &mut parser, &NullReporter);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue