mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibJS: Convert test-js/test-web/test-wasm to ThrowCompletionOr
This commit is contained in:
parent
40eb3a39d4
commit
44555eb50a
4 changed files with 40 additions and 64 deletions
|
@ -40,7 +40,7 @@ TESTJS_MAIN_HOOK()
|
|||
|
||||
TESTJS_GLOBAL_FUNCTION(load_local_page, loadLocalPage)
|
||||
{
|
||||
auto name = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
auto name = TRY(vm.argument(0).to_string(global_object));
|
||||
|
||||
// Clear the hooks
|
||||
before_initial_load_hooks.clear();
|
||||
|
@ -59,8 +59,7 @@ TESTJS_GLOBAL_FUNCTION(after_initial_page_load, afterInitialPageLoad)
|
|||
auto function = vm.argument(0);
|
||||
if (!function.is_function()) {
|
||||
dbgln("afterInitialPageLoad argument is not a function");
|
||||
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Function");
|
||||
return {};
|
||||
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Function");
|
||||
}
|
||||
|
||||
after_initial_load_hooks.append([fn = JS::make_handle(&function.as_function()), &vm](auto& page_object) {
|
||||
|
@ -74,8 +73,7 @@ TESTJS_GLOBAL_FUNCTION(before_initial_page_load, beforeInitialPageLoad)
|
|||
auto function = vm.argument(0);
|
||||
if (!function.is_function()) {
|
||||
dbgln("beforeInitialPageLoad argument is not a function");
|
||||
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Function");
|
||||
return {};
|
||||
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "Function");
|
||||
}
|
||||
|
||||
before_initial_load_hooks.append([fn = JS::make_handle(&function.as_function()), &vm](auto& page_object) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue