summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrestonLTaylor <95388976+PrestonLTaylor@users.noreply.github.com>2023-05-25 20:37:57 +0100
committerAndreas Kling <kling@serenityos.org>2023-05-26 05:23:09 +0200
commit5d3b7a5ecca912ca1ebba379bc076492e7c565b5 (patch)
treead1f4b16ab284b9e61adf6662440bb7dc27758e2
parent6891676fceb1ae8aab849c0c48fd96868777adf4 (diff)
downloadserenity-5d3b7a5ecca912ca1ebba379bc076492e7c565b5.zip
LibWeb: Return DOMException instead of crashing when setting attributes
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp10
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp8
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLImageElement.h4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp14
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp8
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h4
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp6
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableElement.h2
24 files changed, 57 insertions, 51 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
index ae97373209..7991138435 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
@@ -42,9 +42,9 @@ DeprecatedString HTMLAnchorElement::hyperlink_element_utils_href() const
return attribute(HTML::AttributeNames::href);
}
-void HTMLAnchorElement::set_hyperlink_element_utils_href(DeprecatedString href)
+WebIDL::ExceptionOr<void> HTMLAnchorElement::set_hyperlink_element_utils_href(DeprecatedString href)
{
- MUST(set_attribute(HTML::AttributeNames::href, move(href)));
+ return set_attribute(HTML::AttributeNames::href, move(href));
}
void HTMLAnchorElement::run_activation_behavior(Web::DOM::Event const&)
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
index e33e3d46bd..5df9eaf1dd 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
@@ -49,7 +49,7 @@ private:
// ^HTML::HTMLHyperlinkElementUtils
virtual DOM::Document& hyperlink_element_utils_document() override { return document(); }
virtual DeprecatedString hyperlink_element_utils_href() const override;
- virtual void set_hyperlink_element_utils_href(DeprecatedString) override;
+ virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(DeprecatedString) override;
virtual bool hyperlink_element_utils_is_html_anchor_element() const final { return true; }
virtual bool hyperlink_element_utils_is_connected() const final { return is_connected(); }
virtual DeprecatedString hyperlink_element_utils_target() const final { return target(); }
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp
index 99a48fd4df..9558343d21 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp
@@ -38,9 +38,9 @@ DeprecatedString HTMLAreaElement::hyperlink_element_utils_href() const
return attribute(HTML::AttributeNames::href);
}
-void HTMLAreaElement::set_hyperlink_element_utils_href(DeprecatedString href)
+WebIDL::ExceptionOr<void> HTMLAreaElement::set_hyperlink_element_utils_href(DeprecatedString href)
{
- MUST(set_attribute(HTML::AttributeNames::href, move(href)));
+ return set_attribute(HTML::AttributeNames::href, move(href));
}
// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h
index 936b207da6..891e4101db 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h
@@ -32,7 +32,7 @@ private:
// ^HTML::HTMLHyperlinkElementUtils
virtual DOM::Document& hyperlink_element_utils_document() override { return document(); }
virtual DeprecatedString hyperlink_element_utils_href() const override;
- virtual void set_hyperlink_element_utils_href(DeprecatedString) override;
+ virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(DeprecatedString) override;
virtual bool hyperlink_element_utils_is_html_anchor_element() const override { return false; }
virtual bool hyperlink_element_utils_is_connected() const override { return is_connected(); }
virtual DeprecatedString hyperlink_element_utils_target() const override { return ""; }
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp
index 08a40b5cb0..526cd07313 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp
@@ -105,10 +105,10 @@ DeprecatedString HTMLBaseElement::href() const
}
// https://html.spec.whatwg.org/multipage/semantics.html#dom-base-href
-void HTMLBaseElement::set_href(DeprecatedString const& href)
+WebIDL::ExceptionOr<void> HTMLBaseElement::set_href(DeprecatedString const& href)
{
// The href IDL attribute, on setting, must set the href content attribute to the given new value.
- MUST(set_attribute(AttributeNames::href, href));
+ return set_attribute(AttributeNames::href, href);
}
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h
index 986c2a810e..b645574883 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h
@@ -17,7 +17,7 @@ public:
virtual ~HTMLBaseElement() override;
DeprecatedString href() const;
- void set_href(DeprecatedString const& href);
+ WebIDL::ExceptionOr<void> set_href(DeprecatedString const& href);
AK::URL const& frozen_base_url() const { return m_frozen_base_url; }
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp
index 6929edc161..ffe3e84b91 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp
@@ -87,9 +87,9 @@ HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const
return HTMLButtonElement::TypeAttributeState::Submit;
}
-void HTMLButtonElement::set_type(DeprecatedString const& type)
+WebIDL::ExceptionOr<void> HTMLButtonElement::set_type(DeprecatedString const& type)
{
- MUST(set_attribute(HTML::AttributeNames::type, type));
+ return set_attribute(HTML::AttributeNames::type, type);
}
// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
index 3992033eca..d73f25c710 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
@@ -36,7 +36,7 @@ public:
DeprecatedString type() const;
TypeAttributeState type_state() const;
- void set_type(DeprecatedString const&);
+ WebIDL::ExceptionOr<void> set_type(DeprecatedString const&);
// ^EventTarget
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-button-element
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
index b1f2810f37..e2636a7c48 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
@@ -71,18 +71,20 @@ void HTMLCanvasElement::reset_context_to_default_state()
});
}
-void HTMLCanvasElement::set_width(unsigned value)
+WebIDL::ExceptionOr<void> HTMLCanvasElement::set_width(unsigned value)
{
- MUST(set_attribute(HTML::AttributeNames::width, DeprecatedString::number(value)));
+ TRY(set_attribute(HTML::AttributeNames::width, DeprecatedString::number(value)));
m_bitmap = nullptr;
reset_context_to_default_state();
+ return {};
}
-void HTMLCanvasElement::set_height(unsigned value)
+WebIDL::ExceptionOr<void> HTMLCanvasElement::set_height(unsigned value)
{
- MUST(set_attribute(HTML::AttributeNames::height, DeprecatedString::number(value)));
+ TRY(set_attribute(HTML::AttributeNames::height, DeprecatedString::number(value)));
m_bitmap = nullptr;
reset_context_to_default_state();
+ return {};
}
JS::GCPtr<Layout::Node> HTMLCanvasElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h
index f723162843..881ddd777d 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h
@@ -30,8 +30,8 @@ public:
unsigned width() const;
unsigned height() const;
- void set_width(unsigned);
- void set_height(unsigned);
+ WebIDL::ExceptionOr<void> set_width(unsigned);
+ WebIDL::ExceptionOr<void> set_height(unsigned);
DeprecatedString to_data_url(DeprecatedString const& type, Optional<double> quality) const;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp
index d1ed21f6c0..5d4533ce99 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp
@@ -440,10 +440,10 @@ DeprecatedString HTMLHyperlinkElementUtils::href() const
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-href
-void HTMLHyperlinkElementUtils::set_href(DeprecatedString href)
+WebIDL::ExceptionOr<void> HTMLHyperlinkElementUtils::set_href(DeprecatedString href)
{
// The href attribute's setter must set this element's href content attribute's value to the given value.
- set_hyperlink_element_utils_href(move(href));
+ return set_hyperlink_element_utils_href(move(href));
}
// https://html.spec.whatwg.org/multipage/links.html#update-href
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h
index 83388b3ac4..355d7cb2c9 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h
@@ -20,7 +20,7 @@ public:
DeprecatedString origin() const;
DeprecatedString href() const;
- void set_href(DeprecatedString);
+ WebIDL::ExceptionOr<void> set_href(DeprecatedString);
DeprecatedString protocol() const;
void set_protocol(DeprecatedString);
@@ -52,7 +52,7 @@ public:
protected:
virtual DOM::Document& hyperlink_element_utils_document() = 0;
virtual DeprecatedString hyperlink_element_utils_href() const = 0;
- virtual void set_hyperlink_element_utils_href(DeprecatedString) = 0;
+ virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(DeprecatedString) = 0;
virtual bool hyperlink_element_utils_is_html_anchor_element() const = 0;
virtual bool hyperlink_element_utils_is_connected() const = 0;
virtual DeprecatedString hyperlink_element_utils_target() const = 0;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
index e1bbad0b52..b496137212 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
@@ -168,9 +168,9 @@ unsigned HTMLImageElement::width() const
return 0;
}
-void HTMLImageElement::set_width(unsigned width)
+WebIDL::ExceptionOr<void> HTMLImageElement::set_width(unsigned width)
{
- MUST(set_attribute(HTML::AttributeNames::width, DeprecatedString::number(width)));
+ return set_attribute(HTML::AttributeNames::width, DeprecatedString::number(width));
}
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-height
@@ -196,9 +196,9 @@ unsigned HTMLImageElement::height() const
return 0;
}
-void HTMLImageElement::set_height(unsigned height)
+WebIDL::ExceptionOr<void> HTMLImageElement::set_height(unsigned height)
{
- MUST(set_attribute(HTML::AttributeNames::height, DeprecatedString::number(height)));
+ return set_attribute(HTML::AttributeNames::height, DeprecatedString::number(height));
}
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-naturalwidth
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
index cefdd994e1..8f5be7d320 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
@@ -37,10 +37,10 @@ public:
RefPtr<Gfx::Bitmap const> bitmap() const;
unsigned width() const;
- void set_width(unsigned);
+ WebIDL::ExceptionOr<void> set_width(unsigned);
unsigned height() const;
- void set_height(unsigned);
+ WebIDL::ExceptionOr<void> set_height(unsigned);
unsigned natural_width() const;
unsigned natural_height() const;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 2ec5e4c762..c8344fcd3a 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -554,9 +554,9 @@ DeprecatedString HTMLInputElement::type() const
VERIFY_NOT_REACHED();
}
-void HTMLInputElement::set_type(DeprecatedString const& type)
+WebIDL::ExceptionOr<void> HTMLInputElement::set_type(DeprecatedString const& type)
{
- MUST(set_attribute(HTML::AttributeNames::type, type));
+ return set_attribute(HTML::AttributeNames::type, type);
}
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-simple-colour
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
index d89a59f878..6f83d7ee15 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
@@ -58,7 +58,7 @@ public:
DeprecatedString type() const;
TypeAttributeState type_state() const { return m_type; }
- void set_type(DeprecatedString const&);
+ WebIDL::ExceptionOr<void> set_type(DeprecatedString const&);
DeprecatedString default_value() const { return attribute(HTML::AttributeNames::value); }
DeprecatedString name() const { return attribute(HTML::AttributeNames::name); }
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp
index 9fc068cd4d..f28c4549bd 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp
@@ -78,9 +78,9 @@ DeprecatedString HTMLOptionElement::value() const
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-option-value
-void HTMLOptionElement::set_value(DeprecatedString value)
+WebIDL::ExceptionOr<void> HTMLOptionElement::set_value(DeprecatedString value)
{
- MUST(set_attribute(HTML::AttributeNames::value, value));
+ return set_attribute(HTML::AttributeNames::value, value);
}
static void concatenate_descendants_text_content(DOM::Node const* node, StringBuilder& builder)
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h
index 6efbad510b..4226129a3c 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h
@@ -21,7 +21,7 @@ public:
void set_selected(bool);
DeprecatedString value() const;
- void set_value(DeprecatedString);
+ WebIDL::ExceptionOr<void> set_value(DeprecatedString);
DeprecatedString text() const;
void set_text(DeprecatedString);
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp
index a92512aaeb..4b01e99891 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp
@@ -68,13 +68,14 @@ double HTMLProgressElement::value() const
return min(maybe_double.value(), max());
}
-void HTMLProgressElement::set_value(double value)
+WebIDL::ExceptionOr<void> HTMLProgressElement::set_value(double value)
{
if (value < 0)
- return;
+ return {};
- MUST(set_attribute(HTML::AttributeNames::value, DeprecatedString::number(value)));
+ TRY(set_attribute(HTML::AttributeNames::value, DeprecatedString::number(value)));
progress_position_updated();
+ return {};
}
double HTMLProgressElement::max() const
@@ -94,13 +95,14 @@ double HTMLProgressElement::max() const
return double_or_none.value();
}
-void HTMLProgressElement::set_max(double value)
+WebIDL::ExceptionOr<void> HTMLProgressElement::set_max(double value)
{
if (value <= 0)
- return;
+ return {};
- MUST(set_attribute(HTML::AttributeNames::max, DeprecatedString::number(value)));
+ TRY(set_attribute(HTML::AttributeNames::max, DeprecatedString::number(value)));
progress_position_updated();
+ return {};
}
double HTMLProgressElement::position() const
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h
index 7a0786be1e..19e24bb31d 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h
@@ -20,10 +20,10 @@ public:
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
double value() const;
- void set_value(double);
+ WebIDL::ExceptionOr<void> set_value(double);
double max() const;
- void set_max(double value);
+ WebIDL::ExceptionOr<void> set_max(double value);
double position() const;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp
index 762843569f..7a7b759f34 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp
@@ -64,9 +64,9 @@ unsigned int HTMLTableCellElement::col_span() const
return attribute(HTML::AttributeNames::colspan).to_uint().value_or(1);
}
-void HTMLTableCellElement::set_col_span(unsigned int value)
+WebIDL::ExceptionOr<void> HTMLTableCellElement::set_col_span(unsigned int value)
{
- MUST(set_attribute(HTML::AttributeNames::colspan, DeprecatedString::number(value)));
+ return set_attribute(HTML::AttributeNames::colspan, DeprecatedString::number(value));
}
unsigned int HTMLTableCellElement::row_span() const
@@ -74,9 +74,9 @@ unsigned int HTMLTableCellElement::row_span() const
return attribute(HTML::AttributeNames::rowspan).to_uint().value_or(1);
}
-void HTMLTableCellElement::set_row_span(unsigned int value)
+WebIDL::ExceptionOr<void> HTMLTableCellElement::set_row_span(unsigned int value)
{
- MUST(set_attribute(HTML::AttributeNames::rowspan, DeprecatedString::number(value)));
+ return set_attribute(HTML::AttributeNames::rowspan, DeprecatedString::number(value));
}
Optional<ARIA::Role> HTMLTableCellElement::default_role() const
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h
index 5e5b681217..f84cd3301c 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h
@@ -19,8 +19,8 @@ public:
unsigned col_span() const;
unsigned row_span() const;
- void set_col_span(unsigned);
- void set_row_span(unsigned);
+ WebIDL::ExceptionOr<void> set_col_span(unsigned);
+ WebIDL::ExceptionOr<void> set_row_span(unsigned);
virtual Optional<ARIA::Role> default_role() const override;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp
index 41b20d8cb0..c538dc85bf 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp
@@ -72,14 +72,16 @@ JS::GCPtr<HTMLTableCaptionElement> HTMLTableElement::caption()
}
// https://html.spec.whatwg.org/multipage/tables.html#dom-table-caption
-void HTMLTableElement::set_caption(HTMLTableCaptionElement* caption)
+WebIDL::ExceptionOr<void> HTMLTableElement::set_caption(HTMLTableCaptionElement* caption)
{
// On setting, the first caption element child of the table element, if any, must be removed,
// and the new value, if not null, must be inserted as the first node of the table element.
delete_caption();
if (caption)
- MUST(pre_insert(*caption, first_child()));
+ TRY(pre_insert(*caption, first_child()));
+
+ return {};
}
// https://html.spec.whatwg.org/multipage/tables.html#dom-table-createcaption
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h
index e4010a15c0..c909c29ce4 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h
@@ -21,7 +21,7 @@ public:
virtual ~HTMLTableElement() override;
JS::GCPtr<HTMLTableCaptionElement> caption();
- void set_caption(HTMLTableCaptionElement*);
+ WebIDL::ExceptionOr<void> set_caption(HTMLTableCaptionElement*);
JS::NonnullGCPtr<HTMLTableCaptionElement> create_caption();
void delete_caption();