mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Reject selectors with named namespaces in querySelectorAll
8 levels of indentation :thousandyakstare:
This commit is contained in:
parent
4f360b8b01
commit
11982e6732
2 changed files with 49 additions and 22 deletions
|
@ -40,6 +40,33 @@ static WebIDL::ExceptionOr<Variant<GC::Ptr<Element>, GC::Ref<NodeList>>> scope_m
|
||||||
|
|
||||||
auto selectors = maybe_selectors.value();
|
auto selectors = maybe_selectors.value();
|
||||||
|
|
||||||
|
bool has_named_namespace = false;
|
||||||
|
for (auto const& selector : selectors) {
|
||||||
|
for (auto const& compound_selector : selector->compound_selectors()) {
|
||||||
|
for (auto simple_selector : compound_selector.simple_selectors) {
|
||||||
|
if (simple_selector.value.has<CSS::Selector::SimpleSelector::QualifiedName>() && simple_selector.qualified_name().namespace_type == CSS::Selector::SimpleSelector::QualifiedName::NamespaceType::Named) {
|
||||||
|
has_named_namespace = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (simple_selector.value.has<CSS::Selector::SimpleSelector::PseudoClassSelector>()) {
|
||||||
|
for (auto const& argument_selector : simple_selector.pseudo_class().argument_selector_list) {
|
||||||
|
for (auto const& argument_compound_selector : argument_selector->compound_selectors()) {
|
||||||
|
for (auto argument_simple_selector : argument_compound_selector.simple_selectors) {
|
||||||
|
if (argument_simple_selector.value.has<CSS::Selector::SimpleSelector::QualifiedName>() && argument_simple_selector.qualified_name().namespace_type == CSS::Selector::SimpleSelector::QualifiedName::NamespaceType::Named) {
|
||||||
|
has_named_namespace = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (has_named_namespace)
|
||||||
|
return WebIDL::SyntaxError::create(node.realm(), "Failed to parse selector"_string);
|
||||||
|
|
||||||
// 3. Return the result of match a selector against a tree with s and node’s root using scoping root node.
|
// 3. Return the result of match a selector against a tree with s and node’s root using scoping root node.
|
||||||
GC::Ptr<Element> single_result;
|
GC::Ptr<Element> single_result;
|
||||||
Vector<GC::Root<Node>> results;
|
Vector<GC::Root<Node>> results;
|
||||||
|
|
|
@ -6,8 +6,8 @@ Rerun
|
||||||
|
|
||||||
Found 1975 tests
|
Found 1975 tests
|
||||||
|
|
||||||
1931 Pass
|
1951 Pass
|
||||||
44 Fail
|
24 Fail
|
||||||
Details
|
Details
|
||||||
Result Test Name MessagePass Selectors-API Test Suite: HTML
|
Result Test Name MessagePass Selectors-API Test Suite: HTML
|
||||||
Pass Document supports querySelector
|
Pass Document supports querySelector
|
||||||
|
@ -116,10 +116,10 @@ Pass Document.querySelector: Invalid pseudo-element: :::before
|
||||||
Pass Document.querySelectorAll: Invalid pseudo-element: :::before
|
Pass Document.querySelectorAll: Invalid pseudo-element: :::before
|
||||||
Pass Document.querySelector: Invalid pseudo-element: :: before
|
Pass Document.querySelector: Invalid pseudo-element: :: before
|
||||||
Pass Document.querySelectorAll: Invalid pseudo-element: :: before
|
Pass Document.querySelectorAll: Invalid pseudo-element: :: before
|
||||||
Fail Document.querySelector: Undeclared namespace: ns|div
|
Pass Document.querySelector: Undeclared namespace: ns|div
|
||||||
Fail Document.querySelectorAll: Undeclared namespace: ns|div
|
Pass Document.querySelectorAll: Undeclared namespace: ns|div
|
||||||
Fail Document.querySelector: Undeclared namespace: :not(ns|div)
|
Pass Document.querySelector: Undeclared namespace: :not(ns|div)
|
||||||
Fail Document.querySelectorAll: Undeclared namespace: :not(ns|div)
|
Pass Document.querySelectorAll: Undeclared namespace: :not(ns|div)
|
||||||
Pass Document.querySelector: Invalid namespace: ^|div
|
Pass Document.querySelector: Invalid namespace: ^|div
|
||||||
Pass Document.querySelectorAll: Invalid namespace: ^|div
|
Pass Document.querySelectorAll: Invalid namespace: ^|div
|
||||||
Pass Document.querySelector: Invalid namespace: $|div
|
Pass Document.querySelector: Invalid namespace: $|div
|
||||||
|
@ -184,10 +184,10 @@ Pass Detached Element.querySelector: Invalid pseudo-element: :::before
|
||||||
Pass Detached Element.querySelectorAll: Invalid pseudo-element: :::before
|
Pass Detached Element.querySelectorAll: Invalid pseudo-element: :::before
|
||||||
Pass Detached Element.querySelector: Invalid pseudo-element: :: before
|
Pass Detached Element.querySelector: Invalid pseudo-element: :: before
|
||||||
Pass Detached Element.querySelectorAll: Invalid pseudo-element: :: before
|
Pass Detached Element.querySelectorAll: Invalid pseudo-element: :: before
|
||||||
Fail Detached Element.querySelector: Undeclared namespace: ns|div
|
Pass Detached Element.querySelector: Undeclared namespace: ns|div
|
||||||
Fail Detached Element.querySelectorAll: Undeclared namespace: ns|div
|
Pass Detached Element.querySelectorAll: Undeclared namespace: ns|div
|
||||||
Fail Detached Element.querySelector: Undeclared namespace: :not(ns|div)
|
Pass Detached Element.querySelector: Undeclared namespace: :not(ns|div)
|
||||||
Fail Detached Element.querySelectorAll: Undeclared namespace: :not(ns|div)
|
Pass Detached Element.querySelectorAll: Undeclared namespace: :not(ns|div)
|
||||||
Pass Detached Element.querySelector: Invalid namespace: ^|div
|
Pass Detached Element.querySelector: Invalid namespace: ^|div
|
||||||
Pass Detached Element.querySelectorAll: Invalid namespace: ^|div
|
Pass Detached Element.querySelectorAll: Invalid namespace: ^|div
|
||||||
Pass Detached Element.querySelector: Invalid namespace: $|div
|
Pass Detached Element.querySelector: Invalid namespace: $|div
|
||||||
|
@ -252,10 +252,10 @@ Pass Fragment.querySelector: Invalid pseudo-element: :::before
|
||||||
Pass Fragment.querySelectorAll: Invalid pseudo-element: :::before
|
Pass Fragment.querySelectorAll: Invalid pseudo-element: :::before
|
||||||
Pass Fragment.querySelector: Invalid pseudo-element: :: before
|
Pass Fragment.querySelector: Invalid pseudo-element: :: before
|
||||||
Pass Fragment.querySelectorAll: Invalid pseudo-element: :: before
|
Pass Fragment.querySelectorAll: Invalid pseudo-element: :: before
|
||||||
Fail Fragment.querySelector: Undeclared namespace: ns|div
|
Pass Fragment.querySelector: Undeclared namespace: ns|div
|
||||||
Fail Fragment.querySelectorAll: Undeclared namespace: ns|div
|
Pass Fragment.querySelectorAll: Undeclared namespace: ns|div
|
||||||
Fail Fragment.querySelector: Undeclared namespace: :not(ns|div)
|
Pass Fragment.querySelector: Undeclared namespace: :not(ns|div)
|
||||||
Fail Fragment.querySelectorAll: Undeclared namespace: :not(ns|div)
|
Pass Fragment.querySelectorAll: Undeclared namespace: :not(ns|div)
|
||||||
Pass Fragment.querySelector: Invalid namespace: ^|div
|
Pass Fragment.querySelector: Invalid namespace: ^|div
|
||||||
Pass Fragment.querySelectorAll: Invalid namespace: ^|div
|
Pass Fragment.querySelectorAll: Invalid namespace: ^|div
|
||||||
Pass Fragment.querySelector: Invalid namespace: $|div
|
Pass Fragment.querySelector: Invalid namespace: $|div
|
||||||
|
@ -320,10 +320,10 @@ Pass In-document Element.querySelector: Invalid pseudo-element: :::before
|
||||||
Pass In-document Element.querySelectorAll: Invalid pseudo-element: :::before
|
Pass In-document Element.querySelectorAll: Invalid pseudo-element: :::before
|
||||||
Pass In-document Element.querySelector: Invalid pseudo-element: :: before
|
Pass In-document Element.querySelector: Invalid pseudo-element: :: before
|
||||||
Pass In-document Element.querySelectorAll: Invalid pseudo-element: :: before
|
Pass In-document Element.querySelectorAll: Invalid pseudo-element: :: before
|
||||||
Fail In-document Element.querySelector: Undeclared namespace: ns|div
|
Pass In-document Element.querySelector: Undeclared namespace: ns|div
|
||||||
Fail In-document Element.querySelectorAll: Undeclared namespace: ns|div
|
Pass In-document Element.querySelectorAll: Undeclared namespace: ns|div
|
||||||
Fail In-document Element.querySelector: Undeclared namespace: :not(ns|div)
|
Pass In-document Element.querySelector: Undeclared namespace: :not(ns|div)
|
||||||
Fail In-document Element.querySelectorAll: Undeclared namespace: :not(ns|div)
|
Pass In-document Element.querySelectorAll: Undeclared namespace: :not(ns|div)
|
||||||
Pass In-document Element.querySelector: Invalid namespace: ^|div
|
Pass In-document Element.querySelector: Invalid namespace: ^|div
|
||||||
Pass In-document Element.querySelectorAll: Invalid namespace: ^|div
|
Pass In-document Element.querySelectorAll: Invalid namespace: ^|div
|
||||||
Pass In-document Element.querySelector: Invalid namespace: $|div
|
Pass In-document Element.querySelector: Invalid namespace: $|div
|
||||||
|
@ -388,10 +388,10 @@ Pass Empty Element.querySelector: Invalid pseudo-element: :::before
|
||||||
Pass Empty Element.querySelectorAll: Invalid pseudo-element: :::before
|
Pass Empty Element.querySelectorAll: Invalid pseudo-element: :::before
|
||||||
Pass Empty Element.querySelector: Invalid pseudo-element: :: before
|
Pass Empty Element.querySelector: Invalid pseudo-element: :: before
|
||||||
Pass Empty Element.querySelectorAll: Invalid pseudo-element: :: before
|
Pass Empty Element.querySelectorAll: Invalid pseudo-element: :: before
|
||||||
Fail Empty Element.querySelector: Undeclared namespace: ns|div
|
Pass Empty Element.querySelector: Undeclared namespace: ns|div
|
||||||
Fail Empty Element.querySelectorAll: Undeclared namespace: ns|div
|
Pass Empty Element.querySelectorAll: Undeclared namespace: ns|div
|
||||||
Fail Empty Element.querySelector: Undeclared namespace: :not(ns|div)
|
Pass Empty Element.querySelector: Undeclared namespace: :not(ns|div)
|
||||||
Fail Empty Element.querySelectorAll: Undeclared namespace: :not(ns|div)
|
Pass Empty Element.querySelectorAll: Undeclared namespace: :not(ns|div)
|
||||||
Pass Empty Element.querySelector: Invalid namespace: ^|div
|
Pass Empty Element.querySelector: Invalid namespace: ^|div
|
||||||
Pass Empty Element.querySelectorAll: Invalid namespace: ^|div
|
Pass Empty Element.querySelectorAll: Invalid namespace: ^|div
|
||||||
Pass Empty Element.querySelector: Invalid namespace: $|div
|
Pass Empty Element.querySelector: Invalid namespace: $|div
|
||||||
|
|
Loading…
Reference in a new issue