mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:47:34 +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:
parent
7b92889e6b
commit
c5bd382524
1 changed files with 3 additions and 3 deletions
|
@ -22,7 +22,7 @@ NativeFunction* NativeFunction::create(GlobalObject& global_object, const FlyStr
|
||||||
|
|
||||||
NativeFunction::NativeFunction(Object& prototype)
|
NativeFunction::NativeFunction(Object& prototype)
|
||||||
: FunctionObject(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)
|
: FunctionObject(prototype)
|
||||||
, m_name(move(name))
|
, m_name(move(name))
|
||||||
, m_native_function(move(native_function))
|
, 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)
|
NativeFunction::NativeFunction(FlyString name, Object& prototype)
|
||||||
: FunctionObject(prototype)
|
: FunctionObject(prototype)
|
||||||
, m_name(move(name))
|
, m_name(move(name))
|
||||||
, m_realm(&vm().interpreter().realm())
|
, m_realm(vm().interpreter_if_exists() ? &vm().interpreter().realm() : nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue