Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
n-api: Minor updates for review feedback
Browse files Browse the repository at this point in the history
PR-URL: #238
Reviewed-By: Taylor Woll <[email protected]>
Reviewed-By: Kyle Farnung <[email protected]>
  • Loading branch information
jasongin authored and kfarnung committed May 15, 2017
1 parent cc20967 commit 28cdc33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/node_api_jsrt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}

Expand Down
6 changes: 4 additions & 2 deletions test/addons-napi/test_string/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 28cdc33

Please sign in to comment.