mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibJS: Use GlobalObject::associated_realm() for function object realms
As outlined in the previous commit, this should be more reliable than Interpreter::realm(), as we don't always have access to an Interpreter.
This commit is contained in:
parent
cbbf4abb0d
commit
0241071ca2
Notes:
sideshowbarker
2024-07-18 02:22:12 +09:00
Author: https://github.com/linusg
Commit: 0241071ca2
Pull-request: https://github.com/SerenityOS/serenity/pull/10474
Reviewed-by: https://github.com/awesomekling ✅
2 changed files with 4 additions and 4 deletions
|
@ -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<Value(VM&, GlobalObject&
|
|||
: FunctionObject(prototype)
|
||||
, m_name(move(name))
|
||||
, m_native_function(move(native_function))
|
||||
, m_realm(vm().interpreter_if_exists() ? &vm().interpreter().realm() : nullptr)
|
||||
, m_realm(global_object().associated_realm())
|
||||
{
|
||||
}
|
||||
|
||||
NativeFunction::NativeFunction(FlyString name, Object& prototype)
|
||||
: FunctionObject(prototype)
|
||||
, m_name(move(name))
|
||||
, m_realm(vm().interpreter_if_exists() ? &vm().interpreter().realm() : nullptr)
|
||||
, m_realm(global_object().associated_realm())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue