summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-08-28 14:16:32 +0100
committerLinus Groh <mail@linusgroh.de>2022-08-28 16:36:56 +0100
commit78eca3ae64155fbad5035e3254941a62f0de4e1f (patch)
tree2588e15ef7dd356189210c388831d4981c1b3329 /Userland
parentd35f53c34405f45facc1779b1396641941e42b13 (diff)
downloadserenity-78eca3ae64155fbad5035e3254941a62f0de4e1f.zip
LibJS: Move ConsoleObject construction from GlobalObject to Intrinsics
This will allow us to move the underlying console from GlobalObject to ConsoleObject without still having to do a 'console' property lookup on the GlobalObject.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Forward.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/GlobalObject.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intrinsics.cpp1
3 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Forward.h b/Userland/Libraries/LibJS/Forward.h
index d0e9ff5309..527f224250 100644
--- a/Userland/Libraries/LibJS/Forward.h
+++ b/Userland/Libraries/LibJS/Forward.h
@@ -95,6 +95,7 @@
#define JS_ENUMERATE_BUILTIN_NAMESPACE_OBJECTS \
__JS_ENUMERATE(AtomicsObject, atomics) \
+ __JS_ENUMERATE(ConsoleObject, console) \
__JS_ENUMERATE(Intl::Intl, intl) \
__JS_ENUMERATE(JSONObject, json) \
__JS_ENUMERATE(MathObject, math) \
@@ -216,6 +217,7 @@ class TypedArrayConstructor;
class TypedArrayPrototype;
class AtomicsObject;
+class ConsoleObject;
class JSONObject;
class MathObject;
class ReflectObject;
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
index 46e5578067..30ff62a45b 100644
--- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
@@ -172,7 +172,7 @@ void GlobalObject::initialize_global_object(Realm& realm)
// Non-standard
define_direct_property(vm.names.InternalError, realm.intrinsics().internal_error_constructor(), attr);
- define_direct_property(vm.names.console, heap().allocate<ConsoleObject>(realm, realm), attr);
+ define_direct_property(vm.names.console, realm.intrinsics().console_object(), attr);
define_native_function(realm, vm.names.gc, gc, 0, attr);
// Assign intrinsics and functions that depend on the GlobalObject's native functions
diff --git a/Userland/Libraries/LibJS/Runtime/Intrinsics.cpp b/Userland/Libraries/LibJS/Runtime/Intrinsics.cpp
index c7ae6642ac..815f1c10c1 100644
--- a/Userland/Libraries/LibJS/Runtime/Intrinsics.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intrinsics.cpp
@@ -23,6 +23,7 @@
#include <LibJS/Runtime/BigIntPrototype.h>
#include <LibJS/Runtime/BooleanConstructor.h>
#include <LibJS/Runtime/BooleanPrototype.h>
+#include <LibJS/Runtime/ConsoleObject.h>
#include <LibJS/Runtime/DataViewConstructor.h>
#include <LibJS/Runtime/DataViewPrototype.h>
#include <LibJS/Runtime/DateConstructor.h>