diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index b55600f3446..674471acf0c 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -111,7 +111,7 @@ Value FunctionExpression::execute(Interpreter& interpreter, GlobalObject& global func_env->create_immutable_binding(global_object, name(), false); } - auto closure = OrdinaryFunctionObject::create(global_object, name(), body(), parameters(), function_length(), func_env, kind(), is_strict_mode() || interpreter.vm().in_strict_mode(), is_arrow_function()); + auto closure = OrdinaryFunctionObject::create(global_object, name(), body(), parameters(), function_length(), func_env, kind(), is_strict_mode(), is_arrow_function()); if (has_identifier) func_env->initialize_binding(global_object, name(), closure); diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index fea531feb35..5775335d9b2 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -399,6 +399,7 @@ Value perform_eval(Value x, GlobalObject& caller_realm, CallerMode strict_caller return interpreter.execute_statement(caller_realm, program).value_or(js_undefined()); TemporaryChange scope_change(vm.running_execution_context().lexical_environment, static_cast(&caller_realm.environment())); + TemporaryChange scope_change_strict(vm.running_execution_context().is_strict_mode, strict_caller == CallerMode::Strict); return interpreter.execute_statement(caller_realm, program).value_or(js_undefined()); }