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
parent 5f9a36feac
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

@ -420,19 +420,19 @@ WebIDL::ExceptionOr<void> HTMLSelectElement::show_picker()
// 1. If this is not mutable, then throw an "InvalidStateError" DOMException.
if (!enabled())
return WebIDL::InvalidStateError::create(realm(), "Element is not mutable"_fly_string);
return WebIDL::InvalidStateError::create(realm(), "Element is not mutable"_string);
// 2. If this's relevant settings object's origin is not same origin with this's relevant settings object's top-level origin,
// and this is a select element, then throw a "SecurityError" DOMException.
if (!relevant_settings_object(*this).origin().is_same_origin(relevant_settings_object(*this).top_level_origin)) {
return WebIDL::SecurityError::create(realm(), "Cross origin pickers are not allowed"_fly_string);
return WebIDL::SecurityError::create(realm(), "Cross origin pickers are not allowed"_string);
}
// 3. If this's relevant global object does not have transient activation, then throw a "NotAllowedError" DOMException.
// FIXME: The global object we get here should probably not need casted to Window to check for transient activation
auto& global_object = relevant_global_object(*this);
if (!is<HTML::Window>(global_object) || !static_cast<HTML::Window&>(global_object).has_transient_activation()) {
return WebIDL::NotAllowedError::create(realm(), "Too long since user activation to show picker"_fly_string);
return WebIDL::NotAllowedError::create(realm(), "Too long since user activation to show picker"_string);
}
// FIXME: 4. If this is a select element, and this is not being rendered, then throw a "NotSupportedError" DOMException.