mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
!5005 cherry pick PR4718 to OH4.0
Merge pull request !5005 from yaochaonan/cherry-pick-1697704987
This commit is contained in:
commit
f221b45830
@ -63,12 +63,17 @@ std::shared_ptr<JSPandaFile> JSPandaFileManager::LoadJSPandaFile(JSThread *threa
|
||||
}
|
||||
|
||||
EcmaVM *vm = thread->GetEcmaVM();
|
||||
bool mode = thread->GetCurrentEcmaContext()->GetModuleManager()->GetCurrentMode();
|
||||
ModuleManager *moduleManager = thread->GetCurrentEcmaContext()->GetModuleManager();
|
||||
std::unique_ptr<const panda_file::File> pf;
|
||||
if (!vm->IsBundlePack() && mode) {
|
||||
if (!vm->IsBundlePack() && moduleManager->GetExecuteMode()) {
|
||||
ResolveBufferCallback resolveBufferCallback = vm->GetResolveBufferCallback();
|
||||
if (resolveBufferCallback == nullptr) {
|
||||
LOG_ECMA(ERROR) << "resolveBufferCallback is nullptr";
|
||||
#if defined(PANDA_TARGET_WINDOWS) || defined(PANDA_TARGET_MACOS)
|
||||
if (vm->EnableReportModuleResolvingFailure()) {
|
||||
LOG_NO_TAG(ERROR) << "[ArkRuntime Log] Importing shared package is not supported in the Previewer.";
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
uint8_t *data = nullptr;
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
void AddResolveImportedModule(const CString &referencingModule, JSHandle<JSTaggedValue> moduleRecord);
|
||||
void Iterate(const RootVisitor &v);
|
||||
|
||||
bool GetCurrentMode() const
|
||||
bool GetExecuteMode() const
|
||||
{
|
||||
return isExecuteBuffer_;
|
||||
}
|
||||
|
@ -174,18 +174,22 @@ CString ModulePathHelper::ParsePrefixBundle(JSThread *thread, const JSPandaFile
|
||||
}
|
||||
#else
|
||||
CVector<CString> currentVec;
|
||||
StringHelper::SplitString(recordName, currentVec, 0, SEGMENTS_LIMIT_TWO);
|
||||
StringHelper::SplitString(moduleRequestName, currentVec, 0, SEGMENTS_LIMIT_TWO);
|
||||
if (currentVec.size() < SEGMENTS_LIMIT_TWO) {
|
||||
LOG_ECMA(INFO) << "SplitString filed, please check recordName";
|
||||
return CString();
|
||||
}
|
||||
CString currentModuleName = currentVec[1];
|
||||
PathHelper::DeleteNamespace(currentModuleName);
|
||||
if (bundleName != vm->GetBundleName() || moduleName != currentModuleName) {
|
||||
if (bundleName != vm->GetBundleName()) {
|
||||
entryPoint = PREVIEW_OF_ACROSS_HAP_FLAG;
|
||||
if (vm->EnableReportModuleResolvingFailure()) {
|
||||
LOG_NO_TAG(ERROR) << "[ArkRuntime Log] Importing shared package is not supported in the Previewer.";
|
||||
CString msg = "[ArkRuntime Log] Cannot preview this HSP module as " \
|
||||
"it is imported from outside the current application.";
|
||||
LOG_NO_TAG(ERROR) << msg;
|
||||
}
|
||||
} else if (currentModuleName != vm->GetModuleName()) {
|
||||
baseFileName = BUNDLE_INSTALL_PATH + moduleName + MERGE_ABC_ETS_MODULES;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
|
@ -3698,8 +3698,12 @@ void JSNApi::SynchronizVMInfo(EcmaVM *vm, const EcmaVM *hostVM)
|
||||
vm->SetModuleName(hostVM->GetModuleName());
|
||||
vm->SetAssetPath(hostVM->GetAssetPath());
|
||||
vm->SetIsBundlePack(hostVM->IsBundlePack());
|
||||
vm->GetAssociatedJSThread()->GetCurrentEcmaContext()->GetModuleManager()->SetExecuteMode(
|
||||
hostVM->GetAssociatedJSThread()->GetCurrentEcmaContext()->GetModuleManager()->GetCurrentMode());
|
||||
|
||||
ecmascript::ModuleManager *vmModuleManager =
|
||||
vm->GetAssociatedJSThread()->GetCurrentEcmaContext()->GetModuleManager();
|
||||
ecmascript::ModuleManager *hostVMModuleManager =
|
||||
hostVM->GetAssociatedJSThread()->GetCurrentEcmaContext()->GetModuleManager();
|
||||
vmModuleManager->SetExecuteMode(hostVMModuleManager->GetExecuteMode());
|
||||
vm->SetResolveBufferCallback(hostVM->GetResolveBufferCallback());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user