style: Add CSS Error for DisallowedImportRule.

- Add new CSS Error
- Add new test case for error
- Ensure that test cases use `replace()` and `replaceSync()`

Differential Revision: https://phabricator.services.mozilla.com/D69423
This commit is contained in:
Erik Nordin 2020-04-08 22:45:24 +00:00 committed by Emilio Cobos Álvarez
parent c55cd22339
commit 87139a3ea2
2 changed files with 3 additions and 2 deletions

View file

@ -193,7 +193,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
}
if let AllowImportRules::No = self.allow_import_rules {
return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedImportRule))
return Err(input.new_custom_error(StyleParseErrorKind::DisallowedImportRule))
}
// FIXME(emilio): We should always be able to have a loader

View file

@ -137,6 +137,8 @@ pub enum StyleParseErrorKind<'i> {
UnexpectedNamespaceRule,
/// @import must be before any rule but @charset
UnexpectedImportRule,
/// @import rules are disallowed in the parser.
DisallowedImportRule,
/// Unexpected @charset rule encountered.
UnexpectedCharsetRule,
/// Unsupported @ rule
@ -149,7 +151,6 @@ pub enum StyleParseErrorKind<'i> {
ValueError(ValueParseErrorKind<'i>),
/// An error was encountered while parsing a selector
SelectorError(SelectorParseErrorKind<'i>),
/// The property declaration was for an unknown property.
UnknownProperty(CowRcStr<'i>),
/// The property declaration was for a disabled experimental property.