From 55554487b1b1f4285f94a79045cf929bae4df907 Mon Sep 17 00:00:00 2001 From: milkpotatoes Date: Mon, 9 Jun 2025 10:42:24 +0800 Subject: [PATCH] Fix requireNapi not execution under new context Issue: https://gitee.com/openharmony/arkui_napi/issues/ICDKHA Signed-off-by: milkpotatoes --- native_engine/impl/ark/ark_native_engine.cpp | 6 +++--- native_engine/impl/ark/ark_native_engine.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/native_engine/impl/ark/ark_native_engine.cpp b/native_engine/impl/ark/ark_native_engine.cpp index 3fad1ac37..d2998813b 100644 --- a/native_engine/impl/ark/ark_native_engine.cpp +++ b/native_engine/impl/ark/ark_native_engine.cpp @@ -455,9 +455,9 @@ ArkNativeEngine::ArkNativeEngine(NativeEngine* parent, EcmaVM* vm, const Local(this); Local global = JSNApi::GetGlobalObject(vm, context); global->Set(vm, StringRef::NewFromUtf8(vm, REQUIRE_NAPI_FUNCTION_NAME), - FunctionRef::New(vm, RequireNapiForCtxEnv, nullptr, requireData)); + FunctionRef::New(vm, context, RequireNapiForCtxEnv, nullptr, requireData)); global->Set(vm, StringRef::NewFromUtf8(vm, REQUIRE_NAPI_INTERNAL_NAME), - FunctionRef::New(vm, RequireInternal, nullptr, requireData)); + FunctionRef::New(vm, context, RequireInternal, nullptr, requireData)); InitWithoutUV(); // The VM scope callback is initialized during the construction of the root engine and is ignored in this context. @@ -609,7 +609,7 @@ int ArkNativeEngine::CheckAndGetModule( bool &isAppModule, Local &moduleName, NativeModule *&module, - Local exports, + Local &exports, std::string &errInfo) { #ifdef IOS_PLATFORM diff --git a/native_engine/impl/ark/ark_native_engine.h b/native_engine/impl/ark/ark_native_engine.h index 64838b4bf..f67b4b787 100644 --- a/native_engine/impl/ark/ark_native_engine.h +++ b/native_engine/impl/ark/ark_native_engine.h @@ -465,7 +465,7 @@ private: bool &isAppModule, Local &moduleName, NativeModule *&module, - Local exports, + Local &exports, std::string &errInfo ); Local LoadNativeModule( -- Gitee