diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index 6498a554c5..e2acff4bb9 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -43,7 +43,7 @@ ECMAScriptFunctionObject::ECMAScriptFunctionObject(FlyString name, Statement con , m_environment(parent_scope) , m_formal_parameters(move(formal_parameters)) , m_ecmascript_code(ecmascript_code) - , m_realm(vm().interpreter_if_exists() ? &vm().interpreter().realm() : nullptr) + , m_realm(global_object().associated_realm()) , m_strict(strict) , m_name(move(name)) , m_function_length(function_length) diff --git a/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp b/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp index 043968f876..1759fd22c8 100644 --- a/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp @@ -24,7 +24,7 @@ NativeFunction* NativeFunction::create(GlobalObject& global_object, const FlyStr NativeFunction::NativeFunction(Object& prototype) : FunctionObject(prototype) - , m_realm(vm().interpreter_if_exists() ? &vm().interpreter().realm() : nullptr) + , m_realm(global_object().associated_realm()) { } @@ -32,14 +32,14 @@ NativeFunction::NativeFunction(FlyString name, Function