mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Properly propagate errors for Node set_text_content
This function was supposed to throw errors even before the TrustedTypes spec thanks to the CharacterData replaceData call but had a MUST. This changes this to ensure this function can throw an error
This commit is contained in:
parent
887537b061
commit
2fa84f1683
Notes:
github-actions[bot]
2025-10-27 16:16:17 +00:00
Author: https://github.com/tete17
Commit: 2fa84f1683
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6057
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/Lubrsi ✅
7 changed files with 19 additions and 19 deletions
|
|
@ -1082,7 +1082,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
|
|||
m_text_node = realm().create<DOM::Text>(document(), Utf16String {});
|
||||
if (type_state() == TypeAttributeState::Password)
|
||||
m_text_node->set_is_password_input({}, true);
|
||||
m_text_node->set_text_content(m_value);
|
||||
MUST(m_text_node->set_text_content(m_value));
|
||||
handle_maxlength_attribute();
|
||||
MUST(m_inner_text_element->append_child(*m_text_node));
|
||||
|
||||
|
|
@ -1225,15 +1225,15 @@ void HTMLInputElement::update_file_input_shadow_tree()
|
|||
return;
|
||||
|
||||
auto files_label = has_attribute(HTML::AttributeNames::multiple) ? "files"sv : "file"sv;
|
||||
m_file_button->set_text_content(Utf16String::formatted("Select {}...", files_label));
|
||||
MUST(m_file_button->set_text_content(Utf16String::formatted("Select {}...", files_label)));
|
||||
|
||||
if (m_selected_files && m_selected_files->length() > 0) {
|
||||
if (m_selected_files->length() == 1)
|
||||
m_file_label->set_text_content(Utf16String::from_utf8(m_selected_files->item(0)->name()));
|
||||
MUST(m_file_label->set_text_content(Utf16String::from_utf8(m_selected_files->item(0)->name())));
|
||||
else
|
||||
m_file_label->set_text_content(Utf16String::formatted("{} files selected.", m_selected_files->length()));
|
||||
MUST(m_file_label->set_text_content(Utf16String::formatted("{} files selected.", m_selected_files->length())));
|
||||
} else {
|
||||
m_file_label->set_text_content(Utf16String::formatted("No {} selected.", files_label));
|
||||
MUST(m_file_label->set_text_content(Utf16String::formatted("No {} selected.", files_label)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue