From 3bf7f9415035d112fef6099d89992579164fb168 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Fri, 16 May 2025 12:39:06 +1200 Subject: [PATCH] LibJS: Use caller_context to determine strict mode This is functionaly the same since caller_context is the topmost execution context on the stack, but makes it more clear that we are directly inheriting the strict mode from the caller context when pushing the next context on to the stack. --- Libraries/LibJS/Runtime/NativeFunction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibJS/Runtime/NativeFunction.cpp b/Libraries/LibJS/Runtime/NativeFunction.cpp index 68e2bad14d5..a911330c45b 100644 --- a/Libraries/LibJS/Runtime/NativeFunction.cpp +++ b/Libraries/LibJS/Runtime/NativeFunction.cpp @@ -151,7 +151,7 @@ ThrowCompletionOr NativeFunction::internal_call(ExecutionContext& callee_ callee_context.private_environment = caller_context.private_environment; // NOTE: This is a LibJS specific hack for NativeFunction to inherit the strictness of its caller. - callee_context.is_strict_mode = vm.in_strict_mode(); + callee_context.is_strict_mode = caller_context.is_strict_mode; // -------------------------------------------------------------------------- @@ -210,7 +210,7 @@ ThrowCompletionOr> NativeFunction::internal_construct(ReadonlySp callee_context->variable_environment = caller_context.variable_environment; // NOTE: This is a LibJS specific hack for NativeFunction to inherit the strictness of its caller. - callee_context->is_strict_mode = vm.in_strict_mode(); + callee_context->is_strict_mode = caller_context.is_strict_mode; // --------------------------------------------------------------------------