diff options
author | Linus Groh <mail@linusgroh.de> | 2021-09-12 23:10:16 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-09-12 23:12:51 +0100 |
commit | 4f362fc70323169de234f556cfae81bbeb5a257c (patch) | |
tree | 5d03e8401054e75ce2fe7c213fabce19dd67f376 /Userland/Libraries | |
parent | a46b0fc1ffd265c35ce69977f0296e58a35ca2c8 (diff) | |
download | serenity-4f362fc70323169de234f556cfae81bbeb5a257c.zip |
LibJS: Set OrdinaryFunctionObject's realm from the Tnterpreter
...instead of relying on the VM having a current execution context. This
was an incorrect assumption I made, and it caused onfoo attribute
handler construction in LibWeb to crash.
Just use the same mechanism as NativeFunction in the meantime.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/OrdinaryFunctionObject.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/OrdinaryFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/OrdinaryFunctionObject.cpp index b558040532..6d4fd0e5d0 100644 --- a/Userland/Libraries/LibJS/Runtime/OrdinaryFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/OrdinaryFunctionObject.cpp @@ -43,7 +43,7 @@ OrdinaryFunctionObject::OrdinaryFunctionObject(GlobalObject& global_object, cons , m_body(body) , m_parameters(move(parameters)) , m_environment(parent_scope) - , m_realm(vm().current_realm()) + , m_realm(vm().interpreter_if_exists() ? &vm().interpreter().realm() : nullptr) , m_function_length(function_length) , m_kind(kind) , m_is_strict(is_strict) |