1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 17:14:58 +00:00

LibWeb: Make DOMException GC-allocated

This commit is contained in:
Andreas Kling 2022-09-04 16:56:15 +02:00
parent 0e47754ac8
commit 497ead37bc
58 changed files with 307 additions and 278 deletions

View file

@ -109,6 +109,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors)
// 1. Clean up after running script with settings.
settings.clean_up_after_running_script();
dbgln("rethrow");
// 2. Rethrow evaluationStatus.[[Value]].
return JS::throw_completion(*evaluation_status.value());
}
@ -118,15 +119,17 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors)
// 1. Clean up after running script with settings.
settings.clean_up_after_running_script();
dbgln("network error");
// 2. Throw a "NetworkError" DOMException.
return Bindings::throw_dom_exception_if_needed(vm, [] {
return DOM::NetworkError::create("Script error.");
}).release_error();
return throw_completion(DOM::NetworkError::create(settings.global_object(), "Script error."));
}
// 3. Otherwise, rethrow errors is false. Perform the following steps:
VERIFY(rethrow_errors == RethrowErrors::No);
dbgln("no rethrow, stat: {}", evaluation_status.value().value().to_string_without_side_effects());
// 1. Report the exception given by evaluationStatus.[[Value]] for script.
report_exception(evaluation_status);