From 4f436bd323b147b77031d55cf916c4a6f26ae91f Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 28 Aug 2022 14:53:39 +0100 Subject: [PATCH] LibJS: Let NewGlobalEnvironment take a plain Object The object is passed directly to NewObjectEnvironment, which has no requirement for this being a JS::GlobalObject. This is needed for the next change, which will make Realm store a plain Object as for the global object as well. --- Userland/Libraries/LibJS/Runtime/GlobalEnvironment.cpp | 2 +- Userland/Libraries/LibJS/Runtime/GlobalEnvironment.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.cpp index c25e16efac..ec1dbc729e 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.cpp +++ b/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.cpp @@ -15,7 +15,7 @@ namespace JS { // 9.1.2.5 NewGlobalEnvironment ( G, thisValue ), https://tc39.es/ecma262/#sec-newglobalenvironment -GlobalEnvironment::GlobalEnvironment(GlobalObject& global_object, Object& this_value) +GlobalEnvironment::GlobalEnvironment(Object& global_object, Object& this_value) : Environment(nullptr) , m_global_this_value(&this_value) { diff --git a/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.h b/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.h index 08e1557766..bed905d76f 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.h +++ b/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.h @@ -14,7 +14,7 @@ class GlobalEnvironment final : public Environment { JS_ENVIRONMENT(GlobalEnvironment, Environment); public: - GlobalEnvironment(GlobalObject&, Object& this_value); + GlobalEnvironment(Object&, Object& this_value); virtual bool has_this_binding() const final { return true; } virtual ThrowCompletionOr get_this_binding(VM&) const final;