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

@ -121,7 +121,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors, JS::GCPtr<JS::En
settings.clean_up_after_running_script();
// 2. Throw a "NetworkError" DOMException.
return throw_completion(WebIDL::NetworkError::create(settings.realm(), "Script error."_fly_string));
return throw_completion(WebIDL::NetworkError::create(settings.realm(), "Script error."_string));
}
// 3. Otherwise, rethrow errors is false. Perform the following steps:

View file

@ -520,7 +520,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ClassicScript>> fetch_a_classic_worker_impo
if (body_bytes.template has<Empty>() || body_bytes.template has<Fetch::Infrastructure::FetchAlgorithms::ConsumeBodyFailureTag>()
|| !Fetch::Infrastructure::is_ok_status(response->status())
|| !response->header_list()->extract_mime_type().has_value() || !response->header_list()->extract_mime_type()->is_javascript()) {
return WebIDL::NetworkError::create(realm, "Network error"_fly_string);
return WebIDL::NetworkError::create(realm, "Network error"_string);
}
// 8. Let sourceText be the result of UTF-8 decoding bodyBytes.

View file

@ -75,7 +75,7 @@ WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> JavaScriptModuleScript::c
for (auto const& attribute : requested.attributes) {
if (attribute.key != "type"sv) {
// 1. Let error be a new SyntaxError exception.
auto error = JS::SyntaxError::create(settings_object.realm(), "Module request attributes must only contain a type attribute"_fly_string);
auto error = JS::SyntaxError::create(settings_object.realm(), "Module request attributes must only contain a type attribute"_string);
// 2. Set script's parse error to error.
script->set_parse_error(error);
@ -161,7 +161,7 @@ JS::Promise* JavaScriptModuleScript::run(PreventErrorReporting)
// then set evaluationPromise to a promise rejected with a new "QuotaExceededError" DOMException.
if (elevation_promise_or_error.is_error()) {
auto promise = JS::Promise::create(settings_object().realm());
promise->reject(WebIDL::QuotaExceededError::create(settings_object().realm(), "Failed to evaluate module script"_fly_string).ptr());
promise->reject(WebIDL::QuotaExceededError::create(settings_object().realm(), "Failed to evaluate module script"_string).ptr());
evaluation_promise = promise;
} else {