提交 51c32f68 编写于 作者: H huangzhenghua

bugfix of napi hap crash

issue: https://gitee.com/openharmony/xts_acts/issues/I6NHMQSigned-off-by: Nhuangzhenghua <huangzhenghua3@huawei.com>
Change-Id: I0d5f8c2e25c09d6c53603d2c687752a5344aa650
上级 145bef87
......@@ -1862,9 +1862,6 @@ static void AddPromiseCompleteCB(napi_env env, napi_status status, void *data) {
} else {
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));
free(addonData);
......
......@@ -1115,17 +1115,26 @@ export default function nativeApiStringJsunit() {
console.info('aceNapiTest079 START');
value = napitest.testPromise(1).then(
(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();
done();
}, (result) =>{
console.info('aceNapiTest079 testString reject1 result is: ' + result + "--" + JSON.stringify(result));
expect(result < 0).assertTrue();
done();
}
);
value = napitest.testPromise(-1).then(
(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();
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.
先完成此消息的编辑!
想要评论请 注册