diff options
author | Luke Wilde <lukew@serenityos.org> | 2022-04-10 00:57:11 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-04-11 21:23:36 +0100 |
commit | 90f14de1e90854ff8cb364c0d05bc6afca9334b9 (patch) | |
tree | 9f2b490ed9738b35c06bc2cc0e333bd48593f57f /Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp | |
parent | 7798821f5ba4e574d5049f2182c90d229d7923c1 (diff) | |
download | serenity-90f14de1e90854ff8cb364c0d05bc6afca9334b9.zip |
LibJS: Call HostEnsureCanCompileStrings in CreateDynamicFunction
I noticed we were missing this when I added to PerformEval :^)
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp index 39a45e48d3..b417ce12d6 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp @@ -44,12 +44,16 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic VERIFY(vm.execution_context_stack().size() >= 2); // 2. Let callerContext be the second to top element of the execution context stack. + auto& caller_context = *vm.execution_context_stack().at(vm.execution_context_stack().size() - 2); + // 3. Let callerRealm be callerContext's Realm. + auto& caller_realm = *caller_context.realm; + // 4. Let calleeRealm be the current Realm Record. - // NOTE: All of these are only needed for the next step. + auto& callee_realm = *vm.running_execution_context().realm; // 5. Perform ? HostEnsureCanCompileStrings(callerRealm, calleeRealm). - // NOTE: We don't have this yet. + TRY(vm.host_ensure_can_compile_strings(caller_realm, callee_realm)); // 6. If newTarget is undefined, set newTarget to constructor. if (new_target == nullptr) |