mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibJS: Add side-effect-free version of Value::to_string()
There are now two API's on Value: - Value::to_string(Interpreter&) -- may throw. - Value::to_string_without_side_effects() -- will never throw. These are some pretty big sweeping changes, so it's possible that I did some part the wrong way. We'll work it out as we go. :^) Fixes #2123.
This commit is contained in:
@@ -74,8 +74,12 @@ JS::Value ElementWrapper::inner_html_getter(JS::Interpreter& interpreter)
|
||||
|
||||
void ElementWrapper::inner_html_setter(JS::Interpreter& interpreter, JS::Value value)
|
||||
{
|
||||
if (auto* impl = impl_from(interpreter))
|
||||
impl->set_inner_html(value.to_string());
|
||||
if (auto* impl = impl_from(interpreter)) {
|
||||
auto string = value.to_string(interpreter);
|
||||
if (interpreter.exception())
|
||||
return;
|
||||
impl->set_inner_html(string);
|
||||
}
|
||||
}
|
||||
|
||||
JS::Value ElementWrapper::id_getter(JS::Interpreter& interpreter)
|
||||
@@ -87,8 +91,12 @@ JS::Value ElementWrapper::id_getter(JS::Interpreter& interpreter)
|
||||
|
||||
void ElementWrapper::id_setter(JS::Interpreter& interpreter, JS::Value value)
|
||||
{
|
||||
if (auto* impl = impl_from(interpreter))
|
||||
impl->set_attribute("id", value.to_string());
|
||||
if (auto* impl = impl_from(interpreter)) {
|
||||
auto string = value.to_string(interpreter);
|
||||
if (interpreter.exception())
|
||||
return;
|
||||
impl->set_attribute("id", string);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user