test: pass data into napi_create_external

Since v8 10.1 v8::External::New DCHECKs that the data passed
into it cannot be a nullptr because that's not serializable
as external references. This updates the test to pass a
dummy data pointer to the call - which does not matter for the
test since we only care about whether the finalizer is
called.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/3513234

PR-URL: https://github.com/nodejs/node/pull/42532
Refs: https://github.com/nodejs/node/pull/42115
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Joyee Cheung 2022-04-03 06:57:33 +08:00 committed by GitHub
parent 46f54bda48
commit 7c8d98ea84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
#include "../common.h"
static bool exceptionWasPending = false;
static int num = 0x23432;
static napi_value returnException(napi_env env, napi_callback_info info) {
size_t argc = 1;
@ -83,7 +84,7 @@ static napi_value createExternal(napi_env env, napi_callback_info info) {
napi_value external;
NODE_API_CALL(env,
napi_create_external(env, NULL, finalizer, NULL, &external));
napi_create_external(env, &num, finalizer, NULL, &external));
return external;
}