WebContent: Ignore invalid attributes set via the Inspector

Rather than crash, just ignore these values for now. We should invent a
mechanism to send feedback to the user (perhaps via the JS console).
This commit is contained in:
Timothy Flynn 2024-07-29 17:27:43 -04:00 committed by Andreas Kling
parent 93f2af38b1
commit 4f5604c7db
Notes: github-actions[bot] 2024-07-30 07:42:24 +00:00

View file

@ -650,8 +650,10 @@ void ConnectionFromClient::add_dom_node_attributes(u64 page_id, i32 node_id, Vec
auto& element = static_cast<Web::DOM::Element&>(*dom_node);
for (auto const& attribute : attributes)
element.set_attribute(attribute.name, attribute.value).release_value_but_fixme_should_propagate_errors();
for (auto const& attribute : attributes) {
// NOTE: We ignore invalid attributes for now, but we may want to send feedback to the user that this failed.
(void)element.set_attribute(attribute.name, attribute.value);
}
async_did_finish_editing_dom_node(page_id, element.unique_id());
}
@ -671,7 +673,8 @@ void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, i32 node_id,
if (should_remove_attribute && Web::Infra::is_ascii_case_insensitive_match(name, attribute.name))
should_remove_attribute = false;
element.set_attribute(attribute.name, attribute.value).release_value_but_fixme_should_propagate_errors();
// NOTE: We ignore invalid attributes for now, but we may want to send feedback to the user that this failed.
(void)element.set_attribute(attribute.name, attribute.value);
}
if (should_remove_attribute)