summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-03-22 12:39:03 +0000
committerLinus Groh <mail@linusgroh.de>2022-03-22 18:05:25 +0000
commit07a2c58da0f193a8d5aad34161baaf8e97d53d09 (patch)
tree351491ae0dd06d7ff2230db19c3d51f3107e0dfc /Userland/Libraries/LibWeb
parent3cb7c463a76668323af31b55f7d0a11af7df19c1 (diff)
downloadserenity-07a2c58da0f193a8d5aad34161baaf8e97d53d09.zip
LibWeb: Convert InnerHTML to use TRY for error propagation
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/DOMParsing/InnerHTML.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/Userland/Libraries/LibWeb/DOMParsing/InnerHTML.cpp b/Userland/Libraries/LibWeb/DOMParsing/InnerHTML.cpp
index 6831d9f0c9..d869dc717e 100644
--- a/Userland/Libraries/LibWeb/DOMParsing/InnerHTML.cpp
+++ b/Userland/Libraries/LibWeb/DOMParsing/InnerHTML.cpp
@@ -21,9 +21,7 @@ static DOM::ExceptionOr<NonnullRefPtr<DOM::DocumentFragment>> parse_fragment(Str
for (auto& child : new_children) {
// I don't know if this can throw here, but let's be safe.
- auto result = fragment->append_child(child);
- if (result.is_exception())
- return result.exception();
+ (void)TRY(fragment->append_child(child));
}
return fragment;
@@ -37,10 +35,7 @@ DOM::ExceptionOr<void> inner_html_setter(NonnullRefPtr<DOM::Node> context_object
NonnullRefPtr<DOM::Element> context_element = is<DOM::ShadowRoot>(*context_object) ? *verify_cast<DOM::ShadowRoot>(*context_object).host() : verify_cast<DOM::Element>(*context_object);
// 2. Let fragment be the result of invoking the fragment parsing algorithm with the new value as markup, and with context element.
- auto fragment_or_exception = parse_fragment(value, context_element);
- if (fragment_or_exception.is_exception())
- return fragment_or_exception.exception();
- auto fragment = fragment_or_exception.release_value();
+ auto fragment = TRY(parse_fragment(value, context_element));
// 3. If the context object is a template element, then let context object be the template's template contents (a DocumentFragment).
if (is<HTML::HTMLTemplateElement>(*context_object))