From c5bd38252498e822ecb242e680f78e58448950a8 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 12 Sep 2021 12:52:37 +0100 Subject: [PATCH] LibJS: Leave NativeFunction's Realm unset if VM has no Interpreter There's currently a fallback at the call site where the Realm is needed (due to a slightly incorrect implementation of [[Call]] / [[Construct]]) so this is better than crashing (in LibWeb, currently). --- Userland/Libraries/LibJS/Runtime/NativeFunction.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp b/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp index e784d3aa97..4f3916cc4b 100644 --- a/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp @@ -22,7 +22,7 @@ NativeFunction* NativeFunction::create(GlobalObject& global_object, const FlyStr NativeFunction::NativeFunction(Object& prototype) : FunctionObject(prototype) - , m_realm(&vm().interpreter().realm()) + , m_realm(vm().interpreter_if_exists() ? &vm().interpreter().realm() : nullptr) { } @@ -30,14 +30,14 @@ NativeFunction::NativeFunction(FlyString name, Function