LibWeb: Implement the "error to rethrow" mechanism in HTML::Script

This allows JS module loads to fail and throw without crashing the
WebContent process due to a TODO() assertion.
This commit is contained in:
Andreas Kling 2023-05-18 19:05:56 +02:00
parent 2959c2f2eb
commit 819fb39a87
Notes: sideshowbarker 2024-07-17 22:01:16 +09:00
6 changed files with 47 additions and 22 deletions

View file

@ -619,9 +619,10 @@ void fetch_descendants_of_and_link_a_module_script(JavaScriptModuleScript& modul
// 2. Perform record.Link().
auto linking_result = const_cast<JS::SourceTextModule&>(record).link(result->vm());
// TODO: If this throws an exception, set result's error to rethrow to that exception.
if (linking_result.is_error())
TODO();
// If this throws an exception, set result's error to rethrow to that exception.
if (linking_result.is_throw_completion()) {
result->set_error_to_rethrow(linking_result.release_error().value().value());
}
} else {
// FIXME: 4. Otherwise, set result's error to rethrow to parse error.
TODO();