mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
fix(skill): pass srcEntrance to LoadModule for OHM URL support
ExecuteSkill's LoadModule call omitted the 6th srcEntrance parameter,
so the runtime never entered OHM URL mode for skill module loading
(isOhmUrl_ stayed false because IsOhmUrl("") is false). For apps
compiled with the OHM URL scheme, LoadJsModule fell into the path-based
GetExportObject branch and could not find the skill module's exports,
causing LoadSkillFunction to return nullptr and the skill to silently
fail. Pass the currently iterated srcEntry as srcEntrance so the
runtime auto-detects OHM URL via IsOhmUrl; legacy path-format entries
keep working because IsOhmUrl returns false for them. Aligns with the
normal ability load in UpdateAbilityObj which already passes
abilityInfo->srcEntrance.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
This commit is contained in:
@@ -2669,7 +2669,7 @@ bool JsUIAbility::TryLoadSkillEntry(const std::string &srcEntry,
|
||||
}
|
||||
srcPath.erase(pos);
|
||||
srcPath.append(".abc");
|
||||
skillModuleRef_ = jsRuntime_.LoadModule(param->moduleName_, srcPath, param->hapPath_, true);
|
||||
skillModuleRef_ = jsRuntime_.LoadModule(param->moduleName_, srcPath, param->hapPath_, true, false, srcEntry);
|
||||
if (skillModuleRef_ == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::UIABILITY, "LoadModule failed, path:%{public}s", srcPath.c_str());
|
||||
return false;
|
||||
|
||||
@@ -659,7 +659,7 @@ bool JsServiceExtension::TryLoadSkillEntry(const std::string &srcEntry,
|
||||
}
|
||||
srcPath.erase(pos);
|
||||
srcPath.append(".abc");
|
||||
skillModuleRef_ = jsRuntime_.LoadModule(param->moduleName_, srcPath, param->hapPath_, true);
|
||||
skillModuleRef_ = jsRuntime_.LoadModule(param->moduleName_, srcPath, param->hapPath_, true, false, srcEntry);
|
||||
if (skillModuleRef_ == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "LoadModule failed, path:%{public}s", srcPath.c_str());
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user