LibWeb: Make DOMException take error message as a String

There was no need to use FlyString for error messages, and it just
caused a bunch of churn since these strings typically only existed
during the lifetime of the error.
This commit is contained in:
Andreas Kling 2024-10-12 20:56:21 +02:00 committed by Andreas Kling
commit 175f3febb8
Notes: github-actions[bot] 2024-10-12 19:15:13 +00:00
89 changed files with 464 additions and 462 deletions

View file

@ -281,7 +281,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_selection_start(
if (is<HTMLInputElement>(html_element)) {
auto& input_element = static_cast<HTMLInputElement&>(html_element);
if (!input_element.selection_or_range_applies())
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionStart does not apply to this input type"_fly_string);
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionStart does not apply to this input type"_string);
}
// 2. Let end be the value of this element's selectionEnd attribute.
@ -330,7 +330,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_selection_end(Op
if (is<HTMLInputElement>(html_element)) {
auto& input_element = static_cast<HTMLInputElement&>(html_element);
if (!input_element.selection_or_range_applies())
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionEnd does not apply to this input type"_fly_string);
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionEnd does not apply to this input type"_string);
}
// 2. Set the selection range with the value of this element's selectionStart attribute, the
@ -383,7 +383,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_selection_direct
if (is<HTMLInputElement>(html_element)) {
auto const& input_element = static_cast<HTMLInputElement const&>(html_element);
if (!input_element.selection_direction_applies())
return WebIDL::InvalidStateError::create(input_element.realm(), "selectionDirection does not apply to element"_fly_string);
return WebIDL::InvalidStateError::create(input_element.realm(), "selectionDirection does not apply to element"_string);
}
set_the_selection_range(m_selection_start, m_selection_end, string_to_selection_direction(direction));
@ -403,7 +403,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_range_text(Strin
// throw an "InvalidStateError" DOMException.
auto& html_element = form_associated_element_to_html_element();
if (is<HTMLInputElement>(html_element) && !static_cast<HTMLInputElement&>(html_element).selection_or_range_applies())
return WebIDL::InvalidStateError::create(html_element.realm(), "setRangeText does not apply to this input type"_fly_string);
return WebIDL::InvalidStateError::create(html_element.realm(), "setRangeText does not apply to this input type"_string);
// 2. Set this element's dirty value flag to true.
set_dirty_value_flag(true);
@ -414,7 +414,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_range_text(Strin
// 4. If start is greater than end, then throw an "IndexSizeError" DOMException.
if (start > end)
return WebIDL::IndexSizeError::create(html_element.realm(), "The start argument must be less than or equal to the end argument"_fly_string);
return WebIDL::IndexSizeError::create(html_element.realm(), "The start argument must be less than or equal to the end argument"_string);
// 5. If start is greater than the length of the relevant value of the text control, then set it to the length of the relevant value of the text control.
auto the_relevant_value = relevant_value();
@ -523,7 +523,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_selection_range(
// element, throw an "InvalidStateError" DOMException.
auto& html_element = form_associated_element_to_html_element();
if (is<HTMLInputElement>(html_element) && !static_cast<HTMLInputElement&>(html_element).selection_or_range_applies())
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionRange does not apply to this input type"_fly_string);
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionRange does not apply to this input type"_string);
// 2. Set the selection range with start, end, and direction.
set_the_selection_range(start, end, string_to_selection_direction(direction));