From 28cdc33c8df18922f16bc81c513c9cc32635a6a3 Mon Sep 17 00:00:00 2001 From: Jason Ginchereau Date: Mon, 15 May 2017 10:23:47 -0700 Subject: [PATCH] n-api: Minor updates for review feedback PR-URL: https://github.com/nodejs/node-chakracore/pull/238 Reviewed-By: Taylor Woll Reviewed-By: Kyle Farnung --- src/node_api_jsrt.cc | 4 ++-- test/addons-napi/test_string/test.js | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/node_api_jsrt.cc b/src/node_api_jsrt.cc index 04072ce887b..89c1c0a4863 100644 --- a/src/node_api_jsrt.cc +++ b/src/node_api_jsrt.cc @@ -1494,7 +1494,7 @@ napi_status napi_reference_addref(napi_env env, napi_ref ref, int* result) { JsValueRef target; CHECK_JSRT(JsGetWeakReferenceValue(weakRef, &target)); - if (target == nullptr) { + if (target == JS_INVALID_REFERENCE) { // Called napi_reference_addref when the target is unavailable! return napi_set_last_error(napi_generic_failure); } @@ -1521,7 +1521,7 @@ napi_status napi_reference_release(napi_env env, napi_ref ref, int* result) { JsValueRef target; CHECK_JSRT(JsGetWeakReferenceValue(weakRef, &target)); - if (target == nullptr) { + if (target == JS_INVALID_REFERENCE) { return napi_set_last_error(napi_generic_failure); } diff --git a/test/addons-napi/test_string/test.js b/test/addons-napi/test_string/test.js index 4e404ccdb37..0cd2d125448 100644 --- a/test/addons-napi/test_string/test.js +++ b/test/addons-napi/test_string/test.js @@ -47,7 +47,8 @@ assert.strictEqual(test_string.TestLatin1(str4), str4); assert.strictEqual(test_string.TestUtf8(str4), str4); assert.strictEqual(test_string.TestUtf16(str4), str4); // TODO: https://github.com/nodejs/abi-stable-node/issues/235 -// assert.strictEqual(test_string.TestLatin1Insufficient(str4), str4.slice(0, 3)); +// assert.strictEqual( +// test_string.TestLatin1Insufficient(str4), str4.slice(0, 3)); assert.strictEqual(test_string.TestUtf8Insufficient(str4), str4.slice(0, 1)); assert.strictEqual(test_string.TestUtf16Insufficient(str4), str4.slice(0, 3)); assert.strictEqual(test_string.Utf16Length(str4), 31); @@ -58,7 +59,8 @@ assert.strictEqual(test_string.TestLatin1(str5), str5); assert.strictEqual(test_string.TestUtf8(str5), str5); assert.strictEqual(test_string.TestUtf16(str5), str5); // TODO: https://github.com/nodejs/abi-stable-node/issues/235 -// assert.strictEqual(test_string.TestLatin1Insufficient(str5), str5.slice(0, 3)); +// assert.strictEqual( +// test_string.TestLatin1Insufficient(str5), str5.slice(0, 3)); assert.strictEqual(test_string.TestUtf8Insufficient(str5), str5.slice(0, 1)); assert.strictEqual(test_string.TestUtf16Insufficient(str5), str5.slice(0, 3)); assert.strictEqual(test_string.Utf16Length(str5), 63);