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.

(cherry picked from commit 175f3febb8037a440d4ead7347d3266ee3d345e1;
minorly amended to fix conflict in WebSocket.cpp due to serenity
not having the adapter class removal in LadybirdBrowser/ladybird#1671)
This commit is contained in:
Andreas Kling
2024-10-12 20:56:21 +02:00
committed by Nico Weber
parent a73fb690aa
commit 9b4db4a0e0
89 changed files with 464 additions and 462 deletions

View File

@@ -139,7 +139,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableCellElement>> HTMLTableRowElement:
// 1. If index is less than 1 or greater than the number of elements in the cells collection, then throw an "IndexSizeError" DOMException.
if (index < -1 || index > cells_collection_size)
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than the number of cells"_fly_string);
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than the number of cells"_string);
// 2. Let table cell be the result of creating an element given this tr element's node document, td, and the HTML namespace.
auto& table_cell = static_cast<HTMLTableCellElement&>(*TRY(DOM::create_element(document(), HTML::TagNames::td, Namespace::HTML)));
@@ -164,7 +164,7 @@ WebIDL::ExceptionOr<void> HTMLTableRowElement::delete_cell(i32 index)
// 1. If index is less than 1 or greater than or equal to the number of elements in the cells collection, then throw an "IndexSizeError" DOMException.
if (index < -1 || index >= cells_collection_size)
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than or equal to the number of cells"_fly_string);
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than or equal to the number of cells"_string);
// 2. If index is 1, then remove the last element in the cells collection from its parent, or do nothing if the cells collection is empty.
if (index == -1) {