diff --git a/ecmascript/builtins/builtins_global.cpp b/ecmascript/builtins/builtins_global.cpp index 79cc0c5c73e1a4aead327a2363d2bc77c8648ab5..ddc9c54739393dfd998467b96236d21556d3bc2d 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 77f8f0bb207620d7e523a2123b0b709950aa4829..172359ea2e2930f1bbdf8da50efcadddb200f277 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) {