!10309 uiService, JS exception 应该让进程退出

Merge pull request !10309 from zhubingwei/uiservice-jsexception
This commit is contained in:
openharmony_ci
2024-09-09 11:34:51 +00:00
committed by Gitee
4 changed files with 10 additions and 3 deletions
@@ -935,6 +935,7 @@ ohos_shared_library("ui_service_extension") {
"ace_engine:ace_uicontent",
"c_utils:utils",
"common_event_service:cesfwk_innerkits",
"ets_runtime:libark_jsruntime",
"eventhandler:libeventhandler",
"hilog:libhilog",
"hitrace:hitrace_meter",
@@ -534,7 +534,13 @@ napi_value JsUIServiceExtension::CallObjectMethod(const char* name, napi_value c
}
TAG_LOGD(AAFwkTag::UISERVC_EXT, "CallFunction(%{public}s) ok", name);
napi_value result = nullptr;
TryCatch tryCatch(env);
napi_call_function(env, obj, method, argc, argv, &result);
if (tryCatch.HasCaught()) {
TAG_LOGE(AAFwkTag::UISERVC_EXT, "HandleUncaughtException");
reinterpret_cast<NativeEngine*>(env)->HandleUncaughtException();
}
return result;
}
@@ -454,7 +454,7 @@ HWTEST_F(ServiceExtensionContextTest, service_extension_context_StartUIServiceEx
int32_t accountId = 1;
StartOptions startOptions;
ErrCode result = serviceExtensionContextTest.StartUIServiceExtensionAbility(want, accountId);
EXPECT_EQ(CHECK_PERMISSION_FAILED, result);
EXPECT_NE(ERR_OK, result);
}
/**
@@ -338,7 +338,7 @@ HWTEST_F(UIServiceExtensionTest, GetWindowOption_0200, TestSize.Level1)
extensionWindowConfig->windowAttribute = Rosen::ExtensionWindowAttribute::SUB_WINDOW;
extensionWindowConfig->subWindowOptions.isModal = false;
extensionWindowConfig->subWindowOptions.isTopmost = true;
int32_t hostWindowId{0};
int32_t hostWindowId{100};
Runtime::Options options;
auto runtime = Runtime::Create(options);
@@ -363,7 +363,7 @@ HWTEST_F(UIServiceExtensionTest, GetWindowOption_0300, TestSize.Level1)
extensionWindowConfig->windowAttribute = Rosen::ExtensionWindowAttribute::SUB_WINDOW;
extensionWindowConfig->subWindowOptions.isModal = true;
extensionWindowConfig->subWindowOptions.isTopmost = false;
int32_t hostWindowId{0};
int32_t hostWindowId{100};
Runtime::Options options;
auto runtime = Runtime::Create(options);