代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony/security_security_component_manager 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
diff --git a/interfaces/kits/napi/common/web_errors.cpp b/interfaces/kits/napi/common/web_errors.cpp
index 574936d6..eec5c783 100644
--- a/interfaces/kits/napi/common/web_errors.cpp
+++ b/interfaces/kits/napi/common/web_errors.cpp
@@ -57,6 +57,7 @@ namespace ParamCheckErrorMsgTemplate {
const char* PARAM_NOT_NULL = "BusinessError 401: Parameter error. The type of '%s' can not be ignored.";
const char* PARAM_NOT_NULL_TWO = "BusinessError 401: Parameter error. The type of '%s' and '%s' can not be ignored.";
const char* PARAM_TYPE_INVALID = "BusinessError 401: Parameter error. The type of '%s' is invalid.";
+ const char* PARAM_DETAIL_ERROR_MSG = "BusinessError 401: Parameter error. detail: %s.";
}
namespace NWebError {
std::unordered_map<ErrCode, std::string> g_errCodeMsgMap = {
diff --git a/interfaces/kits/napi/webviewcontroller/napi_webview_controller.cpp b/interfaces/kits/napi/webviewcontroller/napi_webview_controller.cpp
index 303a3b23..ee5811ef 100644
--- a/interfaces/kits/napi/webviewcontroller/napi_webview_controller.cpp
+++ b/interfaces/kits/napi/webviewcontroller/napi_webview_controller.cpp
@@ -5791,10 +5791,12 @@ napi_value NapiWebviewController::SetUrlTrustList(napi_env env, napi_callback_in
return result;
}
- ErrCode ret = webviewController->SetUrlTrustList(urlTrustList);
+ std::string detailMsg;
+ ErrCode ret = webviewController->SetUrlTrustList(urlTrustList, detailMsg);
if (ret != NO_ERROR) {
WVLOG_E("SetUrlTrustList failed, error code: %{public}d", ret);
- BusinessError::ThrowErrorByErrcode(env, ret);
+ BusinessError::ThrowErrorByErrcode(env, ret,
+ NWebError::FormatString(ParamCheckErrorMsgTemplate::PARAM_DETAIL_ERROR_MSG, detailMsg));
return result;
}
return result;
diff --git a/interfaces/kits/napi/webviewcontroller/webview_controller.cpp b/interfaces/kits/napi/webviewcontroller/webview_controller.cpp
index 91415541..26cd903a 100644
--- a/interfaces/kits/napi/webviewcontroller/webview_controller.cpp
+++ b/interfaces/kits/napi/webviewcontroller/webview_controller.cpp
@@ -1769,7 +1769,7 @@ void WebviewController::UpdateInstanceId(int32_t newId)
}
}
-ErrCode WebviewController::SetUrlTrustList(const std::string& urlTrustList)
+ErrCode WebviewController::SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg)
{
auto nweb_ptr = NWebHelper::Instance().GetNWeb(nwebId_);
if (!nweb_ptr) {
@@ -1777,7 +1777,7 @@ ErrCode WebviewController::SetUrlTrustList(const std::string& urlTrustList)
}
int ret = NWebError::NO_ERROR;
- switch (nweb_ptr->SetUrlTrustList(urlTrustList)) {
+ switch (nweb_ptr->SetUrlTrustList(urlTrustList, detailErrMsg)) {
case static_cast<int>(UrlListSetResult::INIT_ERROR):
ret = NWebError::INIT_ERROR;
break;
diff --git a/interfaces/kits/napi/webviewcontroller/webview_controller.h b/interfaces/kits/napi/webviewcontroller/webview_controller.h
index e7623fc3..0cfd667e 100644
--- a/interfaces/kits/napi/webviewcontroller/webview_controller.h
+++ b/interfaces/kits/napi/webviewcontroller/webview_controller.h
@@ -346,7 +346,7 @@ public:
const std::vector<uint8_t>& resource,
const std::map<std::string, std::string>& response_headers,
const uint32_t type);
- ErrCode SetUrlTrustList(const std::string& urlTrustList);
+ ErrCode SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg);
void EnableAdsBlock(bool enable);
diff --git a/ohos_interface/include/ohos_nweb/nweb.h b/ohos_interface/include/ohos_nweb/nweb.h
index 413517bc..47da4ff6 100644
--- a/ohos_interface/include/ohos_nweb/nweb.h
+++ b/ohos_interface/include/ohos_nweb/nweb.h
@@ -1311,8 +1311,10 @@ public:
/**
* @brief Set url trust list.
*
+ * @param urlTrustList The url Trust list.
+ * @param detailErrMsg The url trust list detail message.
*/
- virtual int SetUrlTrustList(const std::string& urlTrustList) {
+ virtual int SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg) {
return 0;
}
diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.cpp
index 1d7a1a5f..f7998093 100644
--- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.cpp
+++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.cpp
@@ -1016,9 +1016,13 @@ void ArkWebNWebImpl::NotifyForNextTouchEvent()
nweb_nweb_->NotifyForNextTouchEvent();
}
-int ArkWebNWebImpl::SetUrlTrustList(const ArkWebString& urlTrustList)
+int ArkWebNWebImpl::SetUrlTrustList(const ArkWebString& urlTrustList, ArkWebString& detailErrMsg)
{
- return nweb_nweb_->SetUrlTrustList(ArkWebStringStructToClass(urlTrustList));
+ std::string detailMsg;
+ int res = nweb_nweb_->SetUrlTrustList(ArkWebStringStructToClass(urlTrustList),
+ detailMsg);
+ detailErrMsg = ArkWebStringClassToStruct(detailMsg);
+ return res;
}
void ArkWebNWebImpl::PutSpanstringConvertHtmlCallback(
diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.h
index 899c9700..cd6e5fd1 100644
--- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.h
+++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.h
@@ -1141,9 +1141,12 @@ public:
/**
* @brief Set url trust list.
+ *
+ * @param urlTrustList The url trust list.
+ * @param detailErrMsg The detail error message.
*/
/*--ark web()--*/
- int SetUrlTrustList(const ArkWebString& urlTrustList) override;
+ int SetUrlTrustList(const ArkWebString& urlTrustList, ArkWebString& detailErrMsg) override;
/**
* @brief Put the callback for convert spanstring to html.
diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp
index 7126861c..e2d941f2 100644
--- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp
+++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp
@@ -1181,11 +1181,14 @@ void ArkWebNWebWrapper::NotifyForNextTouchEvent()
ark_web_nweb_->NotifyForNextTouchEvent();
}
-int ArkWebNWebWrapper::SetUrlTrustList(const std::string& urlTrustList)
+int ArkWebNWebWrapper::SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg)
{
ArkWebString stUrlTrustList = ArkWebStringClassToStruct(urlTrustList);
- int res = ark_web_nweb_->SetUrlTrustList(stUrlTrustList);
+ ArkWebString stDetailErrMsg = ark_web_string_default;
+ int res = ark_web_nweb_->SetUrlTrustList(stUrlTrustList, stDetailErrMsg);
+ detailErrMsg = ArkWebStringStructToClass(stDetailErrMsg);
ArkWebStringStructRelease(stUrlTrustList);
+ ArkWebStringStructRelease(stDetailErrMsg);
return res;
}
diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h
index b4548545..df488db1 100644
--- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h
+++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h
@@ -1155,7 +1155,7 @@ public:
* @brief Set url trust list.
*/
/*--ark web()--*/
- int SetUrlTrustList(const std::string& urlTrustList) override;
+ int SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg) override;
/**
* @brief Put the callback for convert spanstring to html.
diff --git a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_nweb.h b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_nweb.h
index de2931e1..3de308dd 100644
--- a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_nweb.h
+++ b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_nweb.h
@@ -1306,7 +1306,7 @@ public:
*
*/
/*--ark web()--*/
- virtual int SetUrlTrustList(const ArkWebString& urlTrustList) = 0;
+ virtual int SetUrlTrustList(const ArkWebString& urlTrustList, ArkWebString& detailErrMsg) = 0;
/**
* @brief Put the callback, convert sapnstring to html.
diff --git a/test/unittest/common/nweb_create_window.h b/test/unittest/common/nweb_create_window.h
index 10043c1d..1f07c8ba 100644
--- a/test/unittest/common/nweb_create_window.h
+++ b/test/unittest/common/nweb_create_window.h
@@ -288,7 +288,7 @@ public:
}
void SendTouchpadFlingEvent(double x, double y, double vx, double vy) override
{}
- int SetUrlTrustList(const std::string& urlTrustList) override
+ int SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg) override
{
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。