未验证 提交 431b672f 编写于 作者: O openharmony_ci 提交者: Gitee

!8005 napi xts 用例hap crash修复

Merge pull request !8005 from huangzhenghua/master20230314
...@@ -1862,9 +1862,6 @@ static void AddPromiseCompleteCB(napi_env env, napi_status status, void *data) { ...@@ -1862,9 +1862,6 @@ static void AddPromiseCompleteCB(napi_env env, napi_status status, void *data) {
} else { } else {
NAPI_CALL_RETURN_VOID(env, napi_reject_deferred(env, addonData->deferred, result)); NAPI_CALL_RETURN_VOID(env, napi_reject_deferred(env, addonData->deferred, result));
} }
if (addonData->callback != nullptr) {
NAPI_CALL_RETURN_VOID(env, napi_delete_reference(env, addonData->callback));
}
NAPI_CALL_RETURN_VOID(env, napi_delete_async_work(env, addonData->asyncWork)); NAPI_CALL_RETURN_VOID(env, napi_delete_async_work(env, addonData->asyncWork));
free(addonData); free(addonData);
......
...@@ -1115,17 +1115,26 @@ export default function nativeApiStringJsunit() { ...@@ -1115,17 +1115,26 @@ export default function nativeApiStringJsunit() {
console.info('aceNapiTest079 START'); console.info('aceNapiTest079 START');
value = napitest.testPromise(1).then( value = napitest.testPromise(1).then(
(result)=>{ (result)=>{
console.info('aceNapiTest079 testString result is: ' + result + "--" + JSON.stringify(result)); console.info('aceNapiTest079 testString resolve1 result is: ' + result + "--" + JSON.stringify(result));
expect(result > 0).assertTrue(); expect(result > 0).assertTrue();
done();
}, (result) =>{
console.info('aceNapiTest079 testString reject1 result is: ' + result + "--" + JSON.stringify(result));
expect(result < 0).assertTrue();
done();
} }
); );
value = napitest.testPromise(-1).then( value = napitest.testPromise(-1).then(
(result)=>{ (result)=>{
console.info('aceNapiTest079 testString result is: ' + result + "--" + JSON.stringify(result)); console.info('aceNapiTest079 testString resolve2 result is: ' + result + "--" + JSON.stringify(result));
expect(result > 0).assertTrue(); expect(result > 0).assertTrue();
} done();
}, (result) =>{
console.info('aceNapiTest079 testString reject2 result is: ' + result + "--" + JSON.stringify(result));
expect(result < 0).assertTrue();
done();
}
); );
done();
}); });
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册