From 49c5e51c03bea5e87ecd7fb6b7a4aaaed58176a3 Mon Sep 17 00:00:00 2001 From: linchencl3 <932565568@qq.com> Date: Wed, 23 Jul 2025 09:20:07 +0800 Subject: [PATCH] test Signed-off-by: linchencl3 <932565568@qq.com> Change-Id: I93444295ac837e9d4e0bee6de543fbaab985aa66 --- ecmascript/builtins/builtins_global.cpp | 4 ++++ ecmascript/module/module_path_helper.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/ecmascript/builtins/builtins_global.cpp b/ecmascript/builtins/builtins_global.cpp index 79cc0c5c73..ddc9c54739 100644 --- a/ecmascript/builtins/builtins_global.cpp +++ b/ecmascript/builtins/builtins_global.cpp @@ -1003,7 +1003,11 @@ JSTaggedValue BuiltinsGlobal::GetCurrentModuleName(EcmaRuntimeCallInfo *msg) std::pair moduleInfo = EcmaInterpreter::GetCurrentEntryPoint(thread); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); CString fileName = moduleInfo.second; + LOG_FULL(INFO) << "GetCurrentModuleName vm module: " << thread->GetEcmaVM()->GetModuleName(); CString moduleName = ModulePathHelper::GetModuleNameWithBaseFile(fileName); + if (moduleName.size() == 0) { + moduleName = thread->GetEcmaVM()->GetModuleName(); + } ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle result = factory->NewFromUtf8(moduleName.c_str()); return result.GetTaggedValue(); diff --git a/ecmascript/module/module_path_helper.cpp b/ecmascript/module/module_path_helper.cpp index 77f8f0bb20..172359ea2e 100644 --- a/ecmascript/module/module_path_helper.cpp +++ b/ecmascript/module/module_path_helper.cpp @@ -716,6 +716,7 @@ void ModulePathHelper::TranstaleExpressionInput(const JSPandaFile *jsPandaFile, */ CString ModulePathHelper::GetModuleNameWithBaseFile(const CString &baseFileName) { + LOG_FULL(ERROR) << "GetModuleNameWithBaseFile baseFileName: " << baseFileName; size_t pos = CString::npos; if (baseFileName.length() > BUNDLE_INSTALL_PATH_LEN && baseFileName.compare(0, BUNDLE_INSTALL_PATH_LEN, BUNDLE_INSTALL_PATH) == 0) { -- Gitee