mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 06:54:57 +00:00
LibWeb: Return DOMException instead of crashing when setting attributes
This commit is contained in:
parent
6891676fce
commit
5d3b7a5ecc
24 changed files with 57 additions and 51 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue