From 44c03a17e3a4fc797c3e56d9a3e6d9a4b8aa1180 Mon Sep 17 00:00:00 2001 From: y00576111 Date: Sat, 18 Sep 2021 18:29:51 +0800 Subject: [PATCH] fix for ark Signed-off-by: y00576111 Change-Id: Ia258ba0fb0948279c481acc338a6637f65a48ef7 --- jsapi/worker/worker.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/jsapi/worker/worker.cpp b/jsapi/worker/worker.cpp index 0d512fa..015161a 100644 --- a/jsapi/worker/worker.cpp +++ b/jsapi/worker/worker.cpp @@ -88,13 +88,9 @@ void Worker::PrepareForWorkerInstance(const Worker* worker) } std::vector scriptContent; OHOS::CCRuntime::Worker::WorkerCore::getAssertFunc(worker->GetScript(), scriptContent); - std::string stringContent(scriptContent.begin(), scriptContent.end()); - HILOG_INFO("worker:: stringContent = %{private}s", stringContent.c_str()); - napi_value scriptStringNapiValue = nullptr; - napi_create_string_utf8(env, stringContent.c_str(), stringContent.length(), &scriptStringNapiValue); - + HILOG_INFO("worker:: script content size is %{public}d", (int)scriptContent.size()); napi_value execScriptResult = nullptr; - napi_run_script(env, scriptStringNapiValue, &execScriptResult); + napi_run_buffer_script(env, scriptContent, &execScriptResult); if (execScriptResult == nullptr) { // An exception occurred when running the script. HILOG_ERROR("worker:: run script exception occurs, will handle exception");