mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
LibJS: Convert test-js/test-web/test-wasm to ThrowCompletionOr
This commit is contained in:
committed by
Linus Groh
parent
40eb3a39d4
commit
44555eb50a
Notes:
sideshowbarker
2024-07-18 02:47:59 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/44555eb50a5 Pull-request: https://github.com/SerenityOS/serenity/pull/10543 Reviewed-by: https://github.com/linusg
@@ -64,9 +64,9 @@
|
||||
} __testjs_register_##fn {};
|
||||
|
||||
#define TESTJS_GLOBAL_FUNCTION(function, exposed_name, ...) \
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(function); \
|
||||
JS_DECLARE_NATIVE_FUNCTION(function); \
|
||||
__TESTJS_REGISTER_GLOBAL_FUNCTION(#exposed_name, function, ##__VA_ARGS__); \
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(function)
|
||||
JS_DEFINE_NATIVE_FUNCTION(function)
|
||||
|
||||
#define TESTJS_MAIN_HOOK() \
|
||||
struct __TestJS_main_hook { \
|
||||
@@ -120,7 +120,7 @@ extern bool g_run_bytecode;
|
||||
extern bool g_dump_bytecode;
|
||||
extern String g_currently_running_test;
|
||||
struct FunctionWithLength {
|
||||
JS::Value (*function)(JS::VM&, JS::GlobalObject&);
|
||||
JS::ThrowCompletionOr<JS::Value> (*function)(JS::VM&, JS::GlobalObject&);
|
||||
size_t length { 0 };
|
||||
};
|
||||
extern HashMap<String, FunctionWithLength> s_exposed_global_functions;
|
||||
@@ -191,7 +191,7 @@ inline void TestRunnerGlobalObject::initialize_global_object()
|
||||
Base::initialize_global_object();
|
||||
define_direct_property("global", this, JS::Attribute::Enumerable);
|
||||
for (auto& entry : s_exposed_global_functions) {
|
||||
define_old_native_function(
|
||||
define_native_function(
|
||||
entry.key, [fn = entry.value.function](auto& vm, auto& global_object) {
|
||||
return fn(vm, global_object);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user