aboutsummaryrefslogtreecommitdiffstats
path: root/components/selectors/parser.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2020-05-20 23:54:16 +0000
committerEmilio Cobos Álvarez <emilio@crisal.io>2020-06-04 01:50:36 +0200
commita40b2b610a854ef257144a868f5dfb164d25272c (patch)
tree46ef76a54c45b8c5db0dff402b80e7cd12361140 /components/selectors/parser.rs
parenta457a2261b16f7cec7498ff0cfe4d290d13f2fb3 (diff)
downloadservo-a40b2b610a854ef257144a868f5dfb164d25272c.tar.gz
servo-a40b2b610a854ef257144a868f5dfb164d25272c.zip
style: Fix a case where we'd allow parsing functional :host incorrectly.
This is a missing check I should've introduced in bug 1632647. Differential Revision: https://phabricator.services.mozilla.com/D76161
Diffstat (limited to 'components/selectors/parser.rs')
-rw-r--r--components/selectors/parser.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs
index 1548a6fdcab..74f4a48de04 100644
--- a/components/selectors/parser.rs
+++ b/components/selectors/parser.rs
@@ -2207,7 +2207,12 @@ where
"nth-last-of-type" => return parse_nth_pseudo_class(parser, input, state, Component::NthLastOfType),
"is" if parser.parse_is_and_where() => return parse_is_or_where(parser, input, state, Component::Is),
"where" if parser.parse_is_and_where() => return parse_is_or_where(parser, input, state, Component::Where),
- "host" => return Ok(Component::Host(Some(parse_inner_compound_selector(parser, input, state)?))),
+ "host" => {
+ if !state.allows_tree_structural_pseudo_classes() {
+ return Err(input.new_custom_error(SelectorParseErrorKind::InvalidState));
+ }
+ return Ok(Component::Host(Some(parse_inner_compound_selector(parser, input, state)?)));
+ },
"not" => {
if state.intersects(SelectorParsingState::INSIDE_NEGATION) {
return Err(input.new_custom_error(