diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index b450b6296c..9de0101f4d 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -1180,11 +1180,19 @@ ThrowCompletionOr GetByValue::execute_impl(Bytecode::Interpreter& interpre // NOTE: Get the property key from the accumulator before side effects have a chance to overwrite it. auto property_key_value = interpreter.accumulator(); - auto object = TRY(interpreter.reg(m_base).to_object(vm)); - + auto base_value = interpreter.reg(m_base); + auto object = TRY(base_object_for_get(interpreter, base_value)); auto property_key = TRY(property_key_value.to_property_key(vm)); - interpreter.accumulator() = TRY(object->get(property_key)); + if (base_value.is_string()) { + auto string_value = TRY(base_value.as_string().get(vm, property_key)); + if (string_value.has_value()) { + interpreter.accumulator() = *string_value; + return {}; + } + } + + interpreter.accumulator() = TRY(object->internal_get(property_key, base_value)); return {}; }