servo: Merge #19915 - stylo: Fix missing null terminator in error reporting code (from emilio:color-errors-whee); r=jdm

This was causing the patch in bug 1420026 to fail.

Source-Repo: https://github.com/servo/servo
Source-Revision: 4bd0590117d0c76d59a509287a07c3bb9c8321ae

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 2399127ec9eddb478ec4edec488824ec6ccfe1a2
This commit is contained in:
Emilio Cobos Álvarez 2018-01-31 12:37:33 -06:00
Родитель bb553f0d58
Коммит 50cb82c33d
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -13,6 +13,7 @@ use style_traits::ParseError;
use stylesheets::UrlExtraData;
/// Errors that can be encountered while parsing CSS.
#[derive(Debug)]
pub enum ContextualParseError<'a> {
/// A property declaration was not recognized.
UnsupportedPropertyDeclaration(&'a str, ParseError<'a>),

Просмотреть файл

@ -66,6 +66,7 @@ impl<'a> ErrorString<'a> {
}
}
#[derive(Debug)]
enum Action {
Nothing,
Skip,
@ -370,14 +371,14 @@ impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> {
StyleParseErrorKind::ValueError(
ValueParseErrorKind::InvalidColor(..)
)
) => (b"PEColorNotColor", Action::Nothing),
) => (b"PEColorNotColor\0", Action::Nothing),
_ => {
// Not the best error message, since we weren't parsing
// a declaration, just a value. But we don't produce
// UnsupportedValue errors other than InvalidColors
// currently.
debug_assert!(false, "should use a more specific error message");
(b"PEDeclDropped", Action::Nothing)
(b"PEDeclDropped\0", Action::Nothing)
}
}
}