From a9a85d627134243380f831c3cb9b7577908a00a9 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 29 Apr 2019 02:47:50 +0200 Subject: [PATCH] test: check `napi_get_reference_value()` during finalization PR-URL: https://github.com/nodejs/node/pull/27470 Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott --- test/js-native-api/test_reference/test_reference.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/js-native-api/test_reference/test_reference.c b/test/js-native-api/test_reference/test_reference.c index 6a02eb3d005a6f..05d5ae3eab8eb5 100644 --- a/test/js-native-api/test_reference/test_reference.c +++ b/test/js-native-api/test_reference/test_reference.c @@ -1,4 +1,5 @@ #include +#include #include #include "../common.h" @@ -135,6 +136,9 @@ static napi_value GetReferenceValue(napi_env env, napi_callback_info info) { static void DeleteBeforeFinalizeFinalizer( napi_env env, void* finalize_data, void* finalize_hint) { napi_ref* ref = (napi_ref*)finalize_data; + napi_value value; + assert(napi_get_reference_value(env, *ref, &value) == napi_ok); + assert(value == NULL); napi_delete_reference(env, *ref); free(ref); }