From 333b738354a1caed57d187214d29fff12c6d63f6 Mon Sep 17 00:00:00 2001 From: "hanlu1@huawei.com" Date: Wed, 5 Jun 2024 17:02:02 +0800 Subject: [PATCH 01/10] ams feature change Signed-off-by: hanlu1@huawei.com --- frameworks/BUILD.gn | 4 ++-- frameworks/targets/simulator/BUILD.gn | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/BUILD.gn b/frameworks/BUILD.gn index a8db5fe8..cb55294c 100644 --- a/frameworks/BUILD.gn +++ b/frameworks/BUILD.gn @@ -104,7 +104,7 @@ lite_library("ace_lite") { "//third_party/jerryscript:jerry_engine", ] } else { - if (enable_ohos_appexecfwk_feature_ability == true) { + if (ability_lite_enable_ohos_appexecfwk_feature_ability == true) { defines += [ "ABILITY_WINDOW_SUPPORT" ] defines += [ "OHOS_APPEXECFWK_BMS_BUNDLEMANAGER" ] } @@ -132,7 +132,7 @@ lite_library("ace_lite") { defines += [ "JSFWK_TEST=1" ] } - if (enable_ohos_aafwk_multi_tasks_feature == true) { + if (ability_lite_enable_ohos_aafwk_multi_tasks_feature == true) { defines += [ "_MINI_MULTI_TASKS_" ] } } diff --git a/frameworks/targets/simulator/BUILD.gn b/frameworks/targets/simulator/BUILD.gn index 48a505fc..371e8b91 100644 --- a/frameworks/targets/simulator/BUILD.gn +++ b/frameworks/targets/simulator/BUILD.gn @@ -66,7 +66,7 @@ if (os_level == "standard") { } else { defines += [ "JS_PROFILER=0" ] } - if (enable_ohos_appexecfwk_feature_ability == true) { + if (ability_lite_enable_ohos_appexecfwk_feature_ability == true) { defines += [ "ABILITY_WINDOW_SUPPORT" ] } } -- Gitee From c93c7d0f846f55d4f4bab10079b7fcd6ab9eab89 Mon Sep 17 00:00:00 2001 From: "hanlu1@huawei.com" Date: Fri, 7 Jun 2024 16:09:09 +0800 Subject: [PATCH 02/10] f Signed-off-by: hanlu1@huawei.com --- test/ace_test_config.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ace_test_config.gni b/test/ace_test_config.gni index 2f44c794..ee75cb6f 100644 --- a/test/ace_test_config.gni +++ b/test/ace_test_config.gni @@ -114,7 +114,7 @@ all_external_includes = ace_lite_include_dirs + ace_test_includes # add specific defines for test case only here all_defines = ace_test_defines -if (enable_ohos_appexecfwk_feature_ability == true) { +if (ability_lite_enable_ohos_appexecfwk_feature_ability == true) { all_defines += [ "ABILITY_WINDOW_SUPPORT" ] all_defines += [ "OHOS_APPEXECFWK_BMS_BUNDLEMANAGER" ] } -- Gitee From 317bd71f25b4802c3259e7466c2a5c9abe212d5e Mon Sep 17 00:00:00 2001 From: youbing54 Date: Thu, 1 Aug 2024 19:51:48 +0800 Subject: [PATCH 03/10] IssueNo: IAH9L2 describe: Fix memory leak Feature or Bugfix: Bugfix Binary Source:Yes Signed-off-by: youbing54 --- frameworks/src/core/base/js_fwk_common.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/frameworks/src/core/base/js_fwk_common.cpp b/frameworks/src/core/base/js_fwk_common.cpp index 4fd6d1b8..0db315f8 100644 --- a/frameworks/src/core/base/js_fwk_common.cpp +++ b/frameworks/src/core/base/js_fwk_common.cpp @@ -581,11 +581,17 @@ int32_t GetFileSize(const char * const filePath) return 0; } struct stat info = {0}; - int32_t ret = stat(filePath, &info); - if (ret < 0) { - HILOG_ERROR(HILOG_MODULE_ACE, "file doesn't exit or it's empty, [%{public}s],\ - errno: %{public}d, desc = %{public}s", filePath, errno, strerror(errno) ); + const int retryCount = 5; + for (int i = 0; i < retryCount; i++) { + int32_t ret = stat(filePath, &info); + if (ret < 0) { + HILOG_ERROR(HILOG_MODULE_ACE, "file doesn't exit or it's empty, [%{public}s],\ + errno: %{public}d, desc = %{public}s", filePath, errno, strerror(errno) ); + } else { + break; + } } + return info.st_size; } -- Gitee From f4d6d3158475bdc9febeb9ba90d915910aeb2655 Mon Sep 17 00:00:00 2001 From: youbing54 Date: Mon, 5 Aug 2024 19:49:25 +0800 Subject: [PATCH 04/10] IssueNo: IAHW84 describe: Program abnormal exit Feature or Bugfix: Bugfix Binary Source:Yes Signed-off-by: youbing54 --- frameworks/src/core/base/js_fwk_common.cpp | 18 ++++++------------ frameworks/src/core/base/lazy_load_manager.cpp | 2 +- frameworks/src/core/components/component.cpp | 4 ---- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/frameworks/src/core/base/js_fwk_common.cpp b/frameworks/src/core/base/js_fwk_common.cpp index 4fd6d1b8..371e49a5 100644 --- a/frameworks/src/core/base/js_fwk_common.cpp +++ b/frameworks/src/core/base/js_fwk_common.cpp @@ -132,7 +132,6 @@ char *MallocStringOf(jerry_value_t source) char *MallocStringOf(jerry_value_t source, uint16_t *strLength) { if ((IS_UNDEFINED(source)) || (strLength == nullptr)) { - HILOG_ERROR(HILOG_MODULE_ACE, "Invalid input: source is undefined or strLength is nullptr"); return nullptr; } @@ -148,13 +147,12 @@ char *MallocStringOf(jerry_value_t source, uint16_t *strLength) target = jerry_value_to_string(source); } if (IS_ERROR_VALUE(target)) { - HILOG_ERROR(HILOG_MODULE_ACE, "jerry_value_to_string failed, can not continue to generate char buffer"); + HILOG_INFO(HILOG_MODULE_ACE, "jerry_value_to_string failed, can not continue to generate char buffer"); break; } jerry_size_t size = jerry_get_string_size(target); if (size >= UINT16_MAX) { - HILOG_ERROR(HILOG_MODULE_ACE, "String size exceeds UINT16_MAX, cannot process"); break; } buffer = static_cast(ace_malloc(sizeof(jerry_char_t) * (size + 1))); @@ -509,7 +507,7 @@ char *RelocateFilePathRelative(const char * const appRootPath, const char * cons HILOG_ERROR(HILOG_MODULE_ACE, "malloc dirPath memory heap failed."); return nullptr; } - if (memcpy_s(dirPath, len + 1, jsPath, len) != 0) { + if (memcpy_s(dirPath, len, jsPath, len) != 0) { ace_free(dirPath); dirPath = nullptr; return nullptr; @@ -732,9 +730,6 @@ char *ReadJSFile(const char * const appPath, const char * const jsFileName, uint } char *fileBuffer = ReadFile(fullPath, fileSize, JsAppEnvironment::GetInstance()->IsSnapshotMode()); - if (fileBuffer == nullptr) { - HILOG_ERROR(HILOG_MODULE_ACE, "Failed to read JS file from path: %{public}s", fullPath); - } ace_free(fullPath); fullPath = nullptr; return fileBuffer; @@ -801,7 +796,7 @@ char *CreatePathStrFromUrl(const char * const url) pathLength); return nullptr; } - if (memcpy_s(filePath, pathLength + 1, (url + start), pathLength) != 0) { + if (memcpy_s(filePath, pathLength, (url + start), pathLength) != 0) { HILOG_ERROR(HILOG_MODULE_ACE, "append path error when calculating from url"); ace_free(filePath); filePath = nullptr; @@ -850,9 +845,8 @@ void InsertWatcherCommon(Watcher *&head, const jerry_value_t watcher) void ClearWatchersCommon(Watcher *&head) { Watcher *node = head; - Watcher *nextNode = nullptr; while (node) { - nextNode = node->next; + head = node->next; // avoid allocating any JS objects when JS runtime broken if (!(FatalHandler::GetInstance().IsJSRuntimeFatal())) { // call js watcher.unsubscribe to release watcher @@ -861,7 +855,7 @@ void ClearWatchersCommon(Watcher *&head) ReleaseJerryValue(CallJSFunction(unsubscribe, watcher, nullptr, 0), unsubscribe, watcher, VA_ARG_END_FLAG); } delete node; - node = nextNode; + node = head; } head = nullptr; } @@ -1038,7 +1032,7 @@ bool ParseRgbaColor(const char * const source, uint32_t &color, uint8_t &alpha) if (buffer == nullptr) { return false; } - if (memcpy_s(buffer, bufSize + 1, source + idxOpenBrace + 1, bufSize) != 0) { + if (memcpy_s(buffer, bufSize, source + idxOpenBrace + 1, bufSize) != 0) { ace_free(buffer); buffer = nullptr; return false; diff --git a/frameworks/src/core/base/lazy_load_manager.cpp b/frameworks/src/core/base/lazy_load_manager.cpp index c4a74514..d92657e8 100644 --- a/frameworks/src/core/base/lazy_load_manager.cpp +++ b/frameworks/src/core/base/lazy_load_manager.cpp @@ -102,7 +102,7 @@ void LazyLoadManager::AddLazyLoadWatcher(jerry_value_t nativeElement, LazyLoadWatcher *watcher = new LazyLoadWatcher(nativeElement, attrName, getter, keyId); if (watcher == nullptr) { - HILOG_ERROR(HILOG_MODULE_ACE, "create watcher error"); + HILOG_ERROR(HILOG_MODULE_ACE, "create watcher errpr"); return; } lazyWatchersList_.PushBack(watcher); diff --git a/frameworks/src/core/components/component.cpp b/frameworks/src/core/components/component.cpp index e964c2b1..7962a0ef 100644 --- a/frameworks/src/core/components/component.cpp +++ b/frameworks/src/core/components/component.cpp @@ -213,7 +213,6 @@ void Component::Release() // stop view animation if (curTransitionImpl_) { curTransitionImpl_->Stop(); - ACE_DELETE(curTransitionImpl_); } ReleaseViewExtraMsg(); jerry_delete_object_native_pointer(nativeElement_, nullptr); @@ -232,7 +231,6 @@ void Component::Release() jerry_release_value(descriptors_); jerry_release_value(children_); jerry_release_value(viewModel_); - jerry_release_value(options_); } bool Component::UpdateView(uint16_t attrKeyId, jerry_value_t attrValue) @@ -995,7 +993,6 @@ void Component::StartAnimation() if (uiView) { if (curTransitionImpl_ != nullptr) { curTransitionImpl_->Stop(); - ACE_DELETE(curTransitionImpl_); } curTransitionImpl_ = new TransitionImpl(*trans_, uiView); if (curTransitionImpl_ == nullptr) { @@ -1577,7 +1574,6 @@ jerry_value_t Component::SetListForWatcher(jerry_value_t getter, jerry_value_t c jerry_value_t watcher = CallJSWatcher(getter, ListForWatcherCallbackFunc, options); if (IS_UNDEFINED(watcher) || jerry_value_is_error(watcher)) { HILOG_ERROR(HILOG_MODULE_ACE, "Failed to create ListForWatcher instance."); - jerry_release_value(watcher); // release error case, note: release undefined is harmless } else { InsertWatcherCommon(watchersHead_, watcher); } -- Gitee From f72749c2b55de6f194027ddbd5be9baee4abcd97 Mon Sep 17 00:00:00 2001 From: youbing54 Date: Tue, 6 Aug 2024 14:39:49 +0800 Subject: [PATCH 05/10] IssueNo: https://gitee.com/openharmony/arkui_ace_engine_lite/issues/IAI5RS describe: Memory leak Feature or Bugfix: Bugfix Binary Source:Yes Signed-off-by: youbing54 --- frameworks/src/core/base/js_fwk_common.cpp | 7 ++++++- frameworks/src/core/components/component.cpp | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frameworks/src/core/base/js_fwk_common.cpp b/frameworks/src/core/base/js_fwk_common.cpp index 371e49a5..f064ee19 100644 --- a/frameworks/src/core/base/js_fwk_common.cpp +++ b/frameworks/src/core/base/js_fwk_common.cpp @@ -132,6 +132,7 @@ char *MallocStringOf(jerry_value_t source) char *MallocStringOf(jerry_value_t source, uint16_t *strLength) { if ((IS_UNDEFINED(source)) || (strLength == nullptr)) { + HILOG_ERROR(HILOG_MODULE_ACE, "Invalid input: source is undefined or strLength is nullptr"); return nullptr; } @@ -147,12 +148,13 @@ char *MallocStringOf(jerry_value_t source, uint16_t *strLength) target = jerry_value_to_string(source); } if (IS_ERROR_VALUE(target)) { - HILOG_INFO(HILOG_MODULE_ACE, "jerry_value_to_string failed, can not continue to generate char buffer"); + HILOG_ERROR(HILOG_MODULE_ACE, "jerry_value_to_string failed, can not continue to generate char buffer"); break; } jerry_size_t size = jerry_get_string_size(target); if (size >= UINT16_MAX) { + HILOG_ERROR(HILOG_MODULE_ACE, "String size exceeds UINT16_MAX, cannot process"); break; } buffer = static_cast(ace_malloc(sizeof(jerry_char_t) * (size + 1))); @@ -730,6 +732,9 @@ char *ReadJSFile(const char * const appPath, const char * const jsFileName, uint } char *fileBuffer = ReadFile(fullPath, fileSize, JsAppEnvironment::GetInstance()->IsSnapshotMode()); + if (fileBuffer == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to read JS file from path: %{public}s", fullPath); + } ace_free(fullPath); fullPath = nullptr; return fileBuffer; diff --git a/frameworks/src/core/components/component.cpp b/frameworks/src/core/components/component.cpp index 7962a0ef..b7c8bad5 100644 --- a/frameworks/src/core/components/component.cpp +++ b/frameworks/src/core/components/component.cpp @@ -1573,6 +1573,7 @@ jerry_value_t Component::SetListForWatcher(jerry_value_t getter, jerry_value_t c jerry_value_t watcher = CallJSWatcher(getter, ListForWatcherCallbackFunc, options); if (IS_UNDEFINED(watcher) || jerry_value_is_error(watcher)) { + jerry_release_value(watcher); // release error case, note: release undefined is harmless HILOG_ERROR(HILOG_MODULE_ACE, "Failed to create ListForWatcher instance."); } else { InsertWatcherCommon(watchersHead_, watcher); -- Gitee From a968e7580a64d13d0293b69125eb34b41b71ec12 Mon Sep 17 00:00:00 2001 From: youbing54 Date: Wed, 14 Aug 2024 17:07:49 +0800 Subject: [PATCH 06/10] IssueNo: https://gitee.com/openharmony/build/issues/IAJZDI describe: Remove the feature whitelist of ace_deginenlite component Feature or Bugfix: Bugfix Binary Source:Yes Signed-off-by: youbing54 --- bundle.json | 4 +++- frameworks/targets/BUILD.gn | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bundle.json b/bundle.json index 70f89a58..083b7659 100644 --- a/bundle.json +++ b/bundle.json @@ -15,7 +15,9 @@ "syscap": [ "SystemCapability.ArkUI.ArkUI.Lite" ], - "feature": [], + "feature": [ + "ace_engine_lite_feature_product_config = false" + ], "adapted_system_type": [ "mini","small" ], "rom": "521KB", "ram": "~82KB", diff --git a/frameworks/targets/BUILD.gn b/frameworks/targets/BUILD.gn index adb5ffb1..43d31f81 100644 --- a/frameworks/targets/BUILD.gn +++ b/frameworks/targets/BUILD.gn @@ -15,11 +15,11 @@ import("//build/lite/config/component/lite_component.gni") import("//foundation/arkui/ace_engine_lite/ace_lite.gni") declare_args() { - enable_ohos_ace_engine_lite_product_config = false + ace_engine_lite_feature_product_config = false } config("ace_lite_target_config") { - if (enable_ohos_ace_engine_lite_product_config) { + if (ace_engine_lite_feature_product_config) { defines = [ "ENABLE_OHOS_ACELITE_PRODUCT_CONFIG=1" ] } include_dirs = [ "$product_path/ace_lite_config" ] -- Gitee From af117b094e8a2b6808af75987e3d720295dfc4ba Mon Sep 17 00:00:00 2001 From: youbing54 Date: Fri, 16 Aug 2024 03:31:27 +0000 Subject: [PATCH 07/10] update bundle.json. Signed-off-by: youbing54 --- bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle.json b/bundle.json index 083b7659..6ec9db20 100644 --- a/bundle.json +++ b/bundle.json @@ -16,7 +16,7 @@ "SystemCapability.ArkUI.ArkUI.Lite" ], "feature": [ - "ace_engine_lite_feature_product_config = false" + "ace_engine_lite_feature_product_config" ], "adapted_system_type": [ "mini","small" ], "rom": "521KB", -- Gitee From 19b398759e81196326a8008776297f52589d83a1 Mon Sep 17 00:00:00 2001 From: youbing54 Date: Sat, 17 Aug 2024 01:49:21 +0000 Subject: [PATCH 08/10] update bundle.json. Signed-off-by: youbing54 --- bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle.json b/bundle.json index 6ec9db20..389eba04 100644 --- a/bundle.json +++ b/bundle.json @@ -15,7 +15,7 @@ "syscap": [ "SystemCapability.ArkUI.ArkUI.Lite" ], - "feature": [ + "features": [ "ace_engine_lite_feature_product_config" ], "adapted_system_type": [ "mini","small" ], -- Gitee From cdd06d1a91983932e0cad4f7dd9308e91d682cca Mon Sep 17 00:00:00 2001 From: youbing54 Date: Tue, 27 Aug 2024 14:56:31 +0800 Subject: [PATCH 09/10] =?UTF-8?q?IssueNo:=20https://gitee.com/openharmony/?= =?UTF-8?q?arkui=5Face=5Fengine=5Flite/issues/IAMSP2=20describe:=20?= =?UTF-8?q?=E6=89=8B=E8=A1=A8=E8=AE=BE=E5=A4=87=E6=89=93=E5=8D=B0=E4=B8=8D?= =?UTF-8?q?=E5=87=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=20Feature=20or=20Bugfix:?= =?UTF-8?q?=20Bugfix=20Binary=20Source:Yes=20Signed-off-by:=20youbing54?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/common/log/ace_log.cpp | 40 +++++++++++++++++++++++++ frameworks/common/log/ace_log.h | 4 +++ frameworks/src/core/base/dfx_assist.cpp | 12 ++++++++ frameworks/src/core/base/dfx_assist.h | 3 ++ 4 files changed, 59 insertions(+) diff --git a/frameworks/common/log/ace_log.cpp b/frameworks/common/log/ace_log.cpp index 91930692..c56075cb 100644 --- a/frameworks/common/log/ace_log.cpp +++ b/frameworks/common/log/ace_log.cpp @@ -16,6 +16,7 @@ #include "ace_log.h" #include #include +#include #if defined(TARGET_SIMULATOR) && (TARGET_SIMULATOR == 1) #include @@ -98,3 +99,42 @@ void HILOG_DEBUG(HiLogModuleType mod, const char *msg, ...) } // namespace ACELite } // namespace OHOS #endif // TARGET_SIMULATOR + +#if defined(FEATURE_ACELITE_MC_LOG_PRINTF) && (FEATURE_ACELITE_MC_LOG_PRINTF == 1) +void HILOG_CHARACTERS(const size_t size, const char* buffer) +{ + if (size == 0 || buffer == nullptr) { + return; + } + + const size_t len1 = 1; + const size_t len2 = 2; + const size_t len3 = 3; + const size_t len4 = 4; + const size_t len5 = 5; + const size_t chunkSize = 6; + + for (size_t index = 0; index < size; index += chunkSize) { + size_t len = std::min(size - index, chunkSize); + if (len == chunkSize) { + HILOG_ERROR(HILOG_MODULE_ACE, "%{public}c%{public}c%{public}c%{public}c%{public}c%{public}c", + buffer[index], buffer[index + len1], buffer[index + len2], + buffer[index + len3], buffer[index + len4], buffer[index + len5]); + } else if (len == len5) { + HILOG_ERROR(HILOG_MODULE_ACE, "%{public}c%{public}c%{public}c%{public}c%{public}c", + buffer[index], buffer[index + len1], buffer[index + len2], + buffer[index + len3], buffer[index + len4]); + } else if (len == len4) { + HILOG_ERROR(HILOG_MODULE_ACE, "%{public}c%{public}c%{public}c%{public}c", + buffer[index], buffer[index + len1], buffer[index + len2], buffer[index + len3]); + } else if (len == len3) { + HILOG_ERROR(HILOG_MODULE_ACE, "%{public}c%{public}c%{public}c", + buffer[index], buffer[index + len1], buffer[index + len2]); + } else if (len == len2) { + HILOG_ERROR(HILOG_MODULE_ACE, "%{public}c%{public}c", buffer[index], buffer[index + len1]); + } else if (len == len1) { + HILOG_ERROR(HILOG_MODULE_ACE, "%{public}c", buffer[index]); + } + } +} +#endif diff --git a/frameworks/common/log/ace_log.h b/frameworks/common/log/ace_log.h index 0aee2591..b25b1793 100644 --- a/frameworks/common/log/ace_log.h +++ b/frameworks/common/log/ace_log.h @@ -17,6 +17,7 @@ #define OHOS_ACELITE_ACE_LOG_H #include "acelite_config.h" +#include #if ((defined(FEATURE_ACELITE_HI_LOG_PRINTF) && (FEATURE_ACELITE_HI_LOG_PRINTF == 1)) && \ (defined(FEATURE_ACELITE_MC_LOG_PRINTF) && (FEATURE_ACELITE_MC_LOG_PRINTF == 1))) @@ -59,6 +60,9 @@ #ifndef HILOG_RACE #define HILOG_RACE(mod, format, ...) #endif + +void HILOG_CHARACTERS(const size_t size, const char* buffer); + #elif defined(TARGET_SIMULATOR) && (TARGET_SIMULATOR == 1) namespace OHOS { namespace ACELite { diff --git a/frameworks/src/core/base/dfx_assist.cpp b/frameworks/src/core/base/dfx_assist.cpp index 940df71d..fdd67d0d 100644 --- a/frameworks/src/core/base/dfx_assist.cpp +++ b/frameworks/src/core/base/dfx_assist.cpp @@ -55,6 +55,7 @@ void DfxAssist::DumpErrorCode(const jerry_value_t errorValue) errStrBuffer[stringEnd] = '\0'; // output to platform trace HILOG_ERROR(HILOG_MODULE_ACE, " [JS Error]: %{public}s", reinterpret_cast(errStrBuffer)); + PrintErrorInfo(errStrSize, errStrBuffer); // output to user console LogString(LogLevel::LOG_LEVEL_ERR, "[JS Exception]: "); LogString(LogLevel::LOG_LEVEL_ERR, reinterpret_cast(errStrBuffer)); @@ -110,6 +111,7 @@ void DfxAssist::DumpErrorMessage(const jerry_value_t errorValue) jerry_size_t stringEnd = jerry_string_to_utf8_char_buffer(itemVal, errStrBuffer, strSize); errStrBuffer[stringEnd] = '\0'; HILOG_ERROR(HILOG_MODULE_ACE, "%{public}u: %{public}s", i, reinterpret_cast(errStrBuffer)); + PrintErrorInfo(strSize, errStrBuffer); } jerry_release_value(itemVal); } @@ -117,5 +119,15 @@ void DfxAssist::DumpErrorMessage(const jerry_value_t errorValue) errStrBuffer = nullptr; jerry_release_value(backtraceVal); } + +void DfxAssist::PrintErrorInfo(jerry_size_t size, jerry_char_t* errorValue) +{ +#if defined(FEATURE_ACELITE_MC_LOG_PRINTF) && (FEATURE_ACELITE_MC_LOG_PRINTF == 1) + size_t length = reinterpret_cast(size); + char* buffer = reinterpret_cast(errorValue); + + HILOG_CHARACTERS(length, buffer); +#endif +} } // namespace ACELite } // namespace OHOS diff --git a/frameworks/src/core/base/dfx_assist.h b/frameworks/src/core/base/dfx_assist.h index e960ad8b..8661d90d 100644 --- a/frameworks/src/core/base/dfx_assist.h +++ b/frameworks/src/core/base/dfx_assist.h @@ -42,6 +42,9 @@ public: * @brief dump js stack error message */ void DumpErrorMessage(const jerry_value_t errorValue); + +private: + void PrintErrorInfo(jerry_size_t size, jerry_char_t* errorValue); }; } // namespace ACELite } // namespace OHOS -- Gitee From 7d4c26ff921d95c7744f024f42ad1b596b178c4c Mon Sep 17 00:00:00 2001 From: youbing54 Date: Mon, 2 Sep 2024 16:36:13 +0800 Subject: [PATCH 10/10] =?UTF-8?q?IssueNo:=20https://gitee.com/openharmony/?= =?UTF-8?q?arkui=5Face=5Fengine=5Flite/issues/IAO6X4=20describe:=20DfxTddT?= =?UTF-8?q?est::DfxTest002()=E8=B6=85=E5=A4=A7=E5=87=BD=E6=95=B0=E6=95=B4?= =?UTF-8?q?=E6=94=B9=20Feature=20or=20Bugfix:=20Bugfix=20Binary=20Source:Y?= =?UTF-8?q?es=20Signed-off-by:=20youbing54?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/core/modules/test/unittest/common/dfx_tdd_test.cpp | 7 +++++++ .../src/core/modules/test/unittest/common/dfx_tdd_test.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/frameworks/src/core/modules/test/unittest/common/dfx_tdd_test.cpp b/frameworks/src/core/modules/test/unittest/common/dfx_tdd_test.cpp index 7c7e5550..d115a7c4 100644 --- a/frameworks/src/core/modules/test/unittest/common/dfx_tdd_test.cpp +++ b/frameworks/src/core/modules/test/unittest/common/dfx_tdd_test.cpp @@ -615,6 +615,13 @@ void DfxTddTest::DfxTest002() TDD_CASE_END(); return; } + + OnDfxTest002(backtraceVal, page, stackMsgMaxLength, exceptLength); +} + +void DfxTddTest::OnDfxTest002(jerry_value_t& backtraceVal, JSValue& page, + const uint16_t stackMsgMaxLength, const uint8_t exceptLength) +{ uint32_t length = jerry_get_array_length(backtraceVal); EXPECT_EQ(length, exceptLength); jerry_char_t *errStrBuffer = static_cast(ace_malloc(sizeof(jerry_char_t) * (stackMsgMaxLength))); diff --git a/frameworks/src/core/modules/test/unittest/common/dfx_tdd_test.h b/frameworks/src/core/modules/test/unittest/common/dfx_tdd_test.h index 5cea029b..182e9a1f 100644 --- a/frameworks/src/core/modules/test/unittest/common/dfx_tdd_test.h +++ b/frameworks/src/core/modules/test/unittest/common/dfx_tdd_test.h @@ -34,6 +34,8 @@ public: void DfxTest007(); void RunTests(); private: + void OnDfxTest002(jerry_value_t& backtraceVal, JSValue& page, + const uint16_t stackMsgMaxLength, const uint8_t exceptLength); static const char * const BUNDLE1; static const char * const BUNDLE2; static const char * const BUNDLE3; -- Gitee