diff options
author | Linus Groh <mail@linusgroh.de> | 2022-08-22 18:56:16 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-23 13:58:30 +0100 |
commit | 7c468b5a772342243d1b306389c34ce485033392 (patch) | |
tree | 00a97c85b321b88e63709b5202b95c871d178abb /Userland/Libraries/LibTest | |
parent | b465f46e009164b5d2659f216b9307efee187222 (diff) | |
download | serenity-7c468b5a772342243d1b306389c34ce485033392.zip |
LibJS: Pass Realm to GlobalObject::initialize_global_object()
Global object initialization is tightly coupled to realm creation, so
simply pass it to the function instead of relying on the non-standard
'associated realm' concept, which I'd like to remove later.
This works essentially the same way as regular Object::initialize() now.
Additionally this allows us to forward the realm to GlobalObject's
add_constructor() / initialize_constructor() helpers, so they set the
correct realm on the allocated constructor function object.
Diffstat (limited to 'Userland/Libraries/LibTest')
-rw-r--r-- | Userland/Libraries/LibTest/JavaScriptTestRunner.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunner.h b/Userland/Libraries/LibTest/JavaScriptTestRunner.h index 31d326dd57..f53c27203d 100644 --- a/Userland/Libraries/LibTest/JavaScriptTestRunner.h +++ b/Userland/Libraries/LibTest/JavaScriptTestRunner.h @@ -197,12 +197,12 @@ public: virtual ~TestRunnerGlobalObject() override = default; - virtual void initialize_global_object() override; + virtual void initialize_global_object(JS::Realm&) override; }; -inline void TestRunnerGlobalObject::initialize_global_object() +inline void TestRunnerGlobalObject::initialize_global_object(JS::Realm& realm) { - Base::initialize_global_object(); + Base::initialize_global_object(realm); define_direct_property("global", this, JS::Attribute::Enumerable); for (auto& entry : s_exposed_global_functions) { define_native_function( |