mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
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).
This commit is contained in:
committed by
Andreas Kling
parent
7b92889e6b
commit
c5bd382524
@@ -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<Value(VM&, GlobalObject&
|
||||
: FunctionObject(prototype)
|
||||
, m_name(move(name))
|
||||
, m_native_function(move(native_function))
|
||||
, m_realm(&vm().interpreter().realm())
|
||||
, m_realm(vm().interpreter_if_exists() ? &vm().interpreter().realm() : nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
NativeFunction::NativeFunction(FlyString name, Object& prototype)
|
||||
: FunctionObject(prototype)
|
||||
, m_name(move(name))
|
||||
, m_realm(&vm().interpreter().realm())
|
||||
, m_realm(vm().interpreter_if_exists() ? &vm().interpreter().realm() : nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user