mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibWeb/DOM: Properly extract local name and prefix from strict split
Previously we were taking the local name from everything after the first ':', instead of second element of strictly splitting qualified name.
This commit is contained in:
parent
f263a1a6b2
commit
642a2430a9
Notes:
github-actions[bot]
2025-07-09 08:58:32 +00:00
Author: https://github.com/shannonbooth
Commit: 642a2430a9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5365
Reviewed-by: https://github.com/gmta ✅
3 changed files with 22 additions and 34 deletions
|
@ -293,24 +293,14 @@ WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm& realm, Option
|
||||||
auto local_name = qualified_name;
|
auto local_name = qualified_name;
|
||||||
|
|
||||||
// 4. If qualifiedName contains a U+003A (:):
|
// 4. If qualifiedName contains a U+003A (:):
|
||||||
if (qualified_name.code_points().contains(':')) {
|
auto split_result = qualified_name.bytes_as_string_view().split_view(':', SplitBehavior::KeepEmpty);
|
||||||
|
if (split_result.size() > 1) {
|
||||||
// 1. Let splitResult be the result of running strictly split given qualifiedName and U+003A (:).
|
// 1. Let splitResult be the result of running strictly split given qualifiedName and U+003A (:).
|
||||||
// FIXME: Use the "strictly split" algorithm
|
|
||||||
|
|
||||||
size_t index = 0;
|
|
||||||
for (auto code_point : qualified_name.code_points()) {
|
|
||||||
if (code_point == ':')
|
|
||||||
break;
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Set prefix to splitResult[0].
|
// 2. Set prefix to splitResult[0].
|
||||||
auto prefix_view = qualified_name.code_points().unicode_substring_view(0, index);
|
prefix = MUST(FlyString::from_utf8(split_result[0]));
|
||||||
prefix = MUST(FlyString::from_utf8(prefix_view.as_string()));
|
|
||||||
|
|
||||||
// 3. Set localName to splitResult[1].
|
// 3. Set localName to splitResult[1].
|
||||||
auto local_name_view = qualified_name.code_points().unicode_substring_view(index + 1);
|
local_name = MUST(FlyString::from_utf8(split_result[1]));
|
||||||
local_name = MUST(FlyString::from_utf8(local_name_view.as_string()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. If prefix is not a valid namespace prefix, then throw an "InvalidCharacterError" DOMException.
|
// 5. If prefix is not a valid namespace prefix, then throw an "InvalidCharacterError" DOMException.
|
||||||
|
|
|
@ -2,8 +2,7 @@ Harness status: OK
|
||||||
|
|
||||||
Found 430 tests
|
Found 430 tests
|
||||||
|
|
||||||
426 Pass
|
430 Pass
|
||||||
4 Fail
|
|
||||||
Pass DOMImplementation.createDocument(namespace, qualifiedName, doctype)
|
Pass DOMImplementation.createDocument(namespace, qualifiedName, doctype)
|
||||||
Pass createDocument test: null,null,null,null
|
Pass createDocument test: null,null,null,null
|
||||||
Pass createDocument test: metadata for null,null,null
|
Pass createDocument test: metadata for null,null,null
|
||||||
|
@ -94,7 +93,7 @@ Pass createDocument test: characterSet aliases for undefined,"foo1",null
|
||||||
Pass createDocument test: undefined,":foo",null,"INVALID_CHARACTER_ERR"
|
Pass createDocument test: undefined,":foo",null,"INVALID_CHARACTER_ERR"
|
||||||
Pass createDocument test: undefined,"f:oo",null,"NAMESPACE_ERR"
|
Pass createDocument test: undefined,"f:oo",null,"NAMESPACE_ERR"
|
||||||
Pass createDocument test: undefined,"foo:",null,"INVALID_CHARACTER_ERR"
|
Pass createDocument test: undefined,"foo:",null,"INVALID_CHARACTER_ERR"
|
||||||
Fail createDocument test: undefined,"f::oo",null,"INVALID_CHARACTER_ERR"
|
Pass createDocument test: undefined,"f::oo",null,"INVALID_CHARACTER_ERR"
|
||||||
Pass createDocument test: undefined,"xml",null,null
|
Pass createDocument test: undefined,"xml",null,null
|
||||||
Pass createDocument test: metadata for undefined,"xml",null
|
Pass createDocument test: metadata for undefined,"xml",null
|
||||||
Pass createDocument test: characterSet aliases for undefined,"xml",null
|
Pass createDocument test: characterSet aliases for undefined,"xml",null
|
||||||
|
@ -125,11 +124,11 @@ Pass createDocument test: "http://example.com/",":foo",null,"INVALID_CHARACTER_E
|
||||||
Pass createDocument test: "http://example.com/","f:oo",null,null
|
Pass createDocument test: "http://example.com/","f:oo",null,null
|
||||||
Pass createDocument test: metadata for "http://example.com/","f:oo",null
|
Pass createDocument test: metadata for "http://example.com/","f:oo",null
|
||||||
Pass createDocument test: characterSet aliases for "http://example.com/","f:oo",null
|
Pass createDocument test: characterSet aliases for "http://example.com/","f:oo",null
|
||||||
Fail createDocument test: "http://example.com/","f:o:o",null,null
|
Pass createDocument test: "http://example.com/","f:o:o",null,null
|
||||||
Pass createDocument test: metadata for "http://example.com/","f:o:o",null
|
Pass createDocument test: metadata for "http://example.com/","f:o:o",null
|
||||||
Pass createDocument test: characterSet aliases for "http://example.com/","f:o:o",null
|
Pass createDocument test: characterSet aliases for "http://example.com/","f:o:o",null
|
||||||
Pass createDocument test: "http://example.com/","foo:",null,"INVALID_CHARACTER_ERR"
|
Pass createDocument test: "http://example.com/","foo:",null,"INVALID_CHARACTER_ERR"
|
||||||
Fail createDocument test: "http://example.com/","f::oo",null,"INVALID_CHARACTER_ERR"
|
Pass createDocument test: "http://example.com/","f::oo",null,"INVALID_CHARACTER_ERR"
|
||||||
Pass createDocument test: "http://example.com/","a:0",null,"INVALID_CHARACTER_ERR"
|
Pass createDocument test: "http://example.com/","a:0",null,"INVALID_CHARACTER_ERR"
|
||||||
Pass createDocument test: "http://example.com/","0:a",null,null
|
Pass createDocument test: "http://example.com/","0:a",null,null
|
||||||
Pass createDocument test: metadata for "http://example.com/","0:a",null
|
Pass createDocument test: metadata for "http://example.com/","0:a",null
|
||||||
|
@ -214,7 +213,7 @@ Pass createDocument test: characterSet aliases for "http://example.com/","XMLNS:
|
||||||
Pass createDocument test: "http://example.com/","xmlfoo:bar",null,null
|
Pass createDocument test: "http://example.com/","xmlfoo:bar",null,null
|
||||||
Pass createDocument test: metadata for "http://example.com/","xmlfoo:bar",null
|
Pass createDocument test: metadata for "http://example.com/","xmlfoo:bar",null
|
||||||
Pass createDocument test: characterSet aliases for "http://example.com/","xmlfoo:bar",null
|
Pass createDocument test: characterSet aliases for "http://example.com/","xmlfoo:bar",null
|
||||||
Fail createDocument test: "http://example.com/","prefix::local",null,"INVALID_CHARACTER_ERR"
|
Pass createDocument test: "http://example.com/","prefix::local",null,"INVALID_CHARACTER_ERR"
|
||||||
Pass createDocument test: "http://example.com/","namespaceURI:{",null,"INVALID_CHARACTER_ERR"
|
Pass createDocument test: "http://example.com/","namespaceURI:{",null,"INVALID_CHARACTER_ERR"
|
||||||
Pass createDocument test: "http://example.com/","namespaceURI:}",null,"INVALID_CHARACTER_ERR"
|
Pass createDocument test: "http://example.com/","namespaceURI:}",null,"INVALID_CHARACTER_ERR"
|
||||||
Pass createDocument test: "http://example.com/","namespaceURI:~",null,"INVALID_CHARACTER_ERR"
|
Pass createDocument test: "http://example.com/","namespaceURI:~",null,"INVALID_CHARACTER_ERR"
|
||||||
|
|
|
@ -2,8 +2,7 @@ Harness status: OK
|
||||||
|
|
||||||
Found 596 tests
|
Found 596 tests
|
||||||
|
|
||||||
584 Pass
|
596 Pass
|
||||||
12 Fail
|
|
||||||
Pass createElementNS test in HTML document: null,null,null
|
Pass createElementNS test in HTML document: null,null,null
|
||||||
Pass createElementNS test in XML document: null,null,null
|
Pass createElementNS test in XML document: null,null,null
|
||||||
Pass createElementNS test in XHTML document: null,null,null
|
Pass createElementNS test in XHTML document: null,null,null
|
||||||
|
@ -145,9 +144,9 @@ Pass createElementNS test in XHTML document: undefined,"f:oo","NAMESPACE_ERR"
|
||||||
Pass createElementNS test in HTML document: undefined,"foo:","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in HTML document: undefined,"foo:","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in XML document: undefined,"foo:","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XML document: undefined,"foo:","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in XHTML document: undefined,"foo:","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XHTML document: undefined,"foo:","INVALID_CHARACTER_ERR"
|
||||||
Fail createElementNS test in HTML document: undefined,"f::oo","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in HTML document: undefined,"f::oo","INVALID_CHARACTER_ERR"
|
||||||
Fail createElementNS test in XML document: undefined,"f::oo","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XML document: undefined,"f::oo","INVALID_CHARACTER_ERR"
|
||||||
Fail createElementNS test in XHTML document: undefined,"f::oo","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XHTML document: undefined,"f::oo","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in HTML document: undefined,"xml",null
|
Pass createElementNS test in HTML document: undefined,"xml",null
|
||||||
Pass createElementNS test in XML document: undefined,"xml",null
|
Pass createElementNS test in XML document: undefined,"xml",null
|
||||||
Pass createElementNS test in XHTML document: undefined,"xml",null
|
Pass createElementNS test in XHTML document: undefined,"xml",null
|
||||||
|
@ -196,15 +195,15 @@ Pass createElementNS test in XHTML document: "http://example.com/",":foo","INVAL
|
||||||
Pass createElementNS test in HTML document: "http://example.com/","f:oo",null
|
Pass createElementNS test in HTML document: "http://example.com/","f:oo",null
|
||||||
Pass createElementNS test in XML document: "http://example.com/","f:oo",null
|
Pass createElementNS test in XML document: "http://example.com/","f:oo",null
|
||||||
Pass createElementNS test in XHTML document: "http://example.com/","f:oo",null
|
Pass createElementNS test in XHTML document: "http://example.com/","f:oo",null
|
||||||
Fail createElementNS test in HTML document: "http://example.com/","f:o:o",null
|
Pass createElementNS test in HTML document: "http://example.com/","f:o:o",null
|
||||||
Fail createElementNS test in XML document: "http://example.com/","f:o:o",null
|
Pass createElementNS test in XML document: "http://example.com/","f:o:o",null
|
||||||
Fail createElementNS test in XHTML document: "http://example.com/","f:o:o",null
|
Pass createElementNS test in XHTML document: "http://example.com/","f:o:o",null
|
||||||
Pass createElementNS test in HTML document: "http://example.com/","foo:","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in HTML document: "http://example.com/","foo:","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in XML document: "http://example.com/","foo:","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XML document: "http://example.com/","foo:","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in XHTML document: "http://example.com/","foo:","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XHTML document: "http://example.com/","foo:","INVALID_CHARACTER_ERR"
|
||||||
Fail createElementNS test in HTML document: "http://example.com/","f::oo","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in HTML document: "http://example.com/","f::oo","INVALID_CHARACTER_ERR"
|
||||||
Fail createElementNS test in XML document: "http://example.com/","f::oo","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XML document: "http://example.com/","f::oo","INVALID_CHARACTER_ERR"
|
||||||
Fail createElementNS test in XHTML document: "http://example.com/","f::oo","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XHTML document: "http://example.com/","f::oo","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in HTML document: "http://example.com/","a:0","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in HTML document: "http://example.com/","a:0","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in XML document: "http://example.com/","a:0","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XML document: "http://example.com/","a:0","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in XHTML document: "http://example.com/","a:0","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XHTML document: "http://example.com/","a:0","INVALID_CHARACTER_ERR"
|
||||||
|
@ -301,9 +300,9 @@ Pass createElementNS test in XHTML document: "http://example.com/","XMLNS:foo",n
|
||||||
Pass createElementNS test in HTML document: "http://example.com/","xmlfoo:bar",null
|
Pass createElementNS test in HTML document: "http://example.com/","xmlfoo:bar",null
|
||||||
Pass createElementNS test in XML document: "http://example.com/","xmlfoo:bar",null
|
Pass createElementNS test in XML document: "http://example.com/","xmlfoo:bar",null
|
||||||
Pass createElementNS test in XHTML document: "http://example.com/","xmlfoo:bar",null
|
Pass createElementNS test in XHTML document: "http://example.com/","xmlfoo:bar",null
|
||||||
Fail createElementNS test in HTML document: "http://example.com/","prefix::local","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in HTML document: "http://example.com/","prefix::local","INVALID_CHARACTER_ERR"
|
||||||
Fail createElementNS test in XML document: "http://example.com/","prefix::local","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XML document: "http://example.com/","prefix::local","INVALID_CHARACTER_ERR"
|
||||||
Fail createElementNS test in XHTML document: "http://example.com/","prefix::local","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XHTML document: "http://example.com/","prefix::local","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in HTML document: "http://example.com/","namespaceURI:{","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in HTML document: "http://example.com/","namespaceURI:{","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in XML document: "http://example.com/","namespaceURI:{","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XML document: "http://example.com/","namespaceURI:{","INVALID_CHARACTER_ERR"
|
||||||
Pass createElementNS test in XHTML document: "http://example.com/","namespaceURI:{","INVALID_CHARACTER_ERR"
|
Pass createElementNS test in XHTML document: "http://example.com/","namespaceURI:{","INVALID_CHARACTER_ERR"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue