mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
LibWeb/DOM: Avoid passing null to valid name prefix
Applies spec change of 1b4bd48
which we already happened to be doing to avoid crashing.
This commit is contained in:
parent
642a2430a9
commit
24d522afce
Notes:
github-actions[bot]
2025-07-09 08:58:27 +00:00
Author: https://github.com/shannonbooth
Commit: 24d522afce
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5365
Reviewed-by: https://github.com/gmta ✅
1 changed files with 6 additions and 3 deletions
|
@ -301,11 +301,14 @@ WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm& realm, Option
|
|||
|
||||
// 3. Set localName to splitResult[1].
|
||||
local_name = MUST(FlyString::from_utf8(split_result[1]));
|
||||
|
||||
// 4. If prefix is not a valid namespace prefix, then throw an "InvalidCharacterError" DOMException.
|
||||
if (!is_valid_namespace_prefix(*prefix))
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Prefix not a valid namespace prefix."_string);
|
||||
}
|
||||
|
||||
// 5. If prefix is not a valid namespace prefix, then throw an "InvalidCharacterError" DOMException.
|
||||
if (prefix.has_value() && !is_valid_namespace_prefix(*prefix))
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Prefix not a valid namespace prefix."_string);
|
||||
// 5. Assert: prefix is either null or a valid namespace prefix.
|
||||
ASSERT(!prefix.has_value() || is_valid_namespace_prefix(*prefix));
|
||||
|
||||
// 6. If context is "attribute" and localName is not a valid attribute local name, then throw an "InvalidCharacterError" DOMException.
|
||||
if (context == ValidationContext::Attribute && !is_valid_attribute_local_name(local_name))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue