LibWeb: Treat CSS selectors containing undeclared namespaces as invalid

Selectors containing undeclared namespaces should be considered invalid,
not just not matching any elements.

Gains us 3 new WPT passes.
This commit is contained in:
Callum Law 2025-06-23 22:40:37 +12:00 committed by Sam Atkins
commit 6584ae0080
Notes: github-actions[bot] 2025-06-24 11:52:28 +00:00
17 changed files with 157 additions and 11 deletions

View file

@ -66,6 +66,7 @@ Parser::Parser(ParsingParams const& context, Vector<Token> tokens)
, m_tokens(move(tokens))
, m_token_stream(m_tokens)
, m_rule_context(move(context.rule_context))
, m_declared_namespaces(move(context.declared_namespaces))
{
}
@ -141,6 +142,8 @@ GC::RootVector<GC::Ref<CSSRule>> Parser::convert_rules(Vector<Rule> const& raw_r
if (!namespace_rules_valid)
continue;
m_declared_namespaces.set(as<CSSNamespaceRule>(*rule).prefix());
break;
default:
import_rules_valid = false;